1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-04-27 13:48:56 +08:00
deadprogram 9dada20d35 gopigo3: correct error in example
Signed-off-by: deadprogram <ron@hybridgroup.com>
2017-10-23 13:15:55 +02:00

43 lines
733 B
Go

// +build example
//
// Do not build by default.
package main
import (
"fmt"
"time"
"gobot.io/x/gobot"
"gobot.io/x/gobot/platforms/dexter/gopigo3"
"gobot.io/x/gobot/platforms/raspi"
)
func main() {
raspiAdaptor := raspi.NewAdaptor()
gpg3 := gopigo3.NewDriver(raspiAdaptor)
work := func() {
on := uint8(0xFF)
gobot.Every(1000*time.Millisecond, func() {
err := gpg3.SetLED(gopigo3.LED_EYE_RIGHT, 0x00, 0x00, on)
if err != nil {
fmt.Println(err)
}
err = gpg3.SetLED(gopigo3.LED_EYE_LEFT, ^on, 0x00, 0x00)
if err != nil {
fmt.Println(err)
}
on = ^on
})
}
robot := gobot.NewRobot("gopigo3eyeleds",
[]gobot.Connection{raspiAdaptor},
[]gobot.Device{gpg3},
work,
)
robot.Start()
}