38 lines
580 B
Go
38 lines
580 B
Go
// +build example
|
|
//
|
|
// Do not build by default.
|
|
|
|
package main
|
|
|
|
import (
|
|
"os"
|
|
"time"
|
|
|
|
"gobot.io/x/gobot"
|
|
"gobot.io/x/gobot/platforms/ble"
|
|
"gobot.io/x/gobot/platforms/microbit"
|
|
)
|
|
|
|
func main() {
|
|
bleAdaptor := ble.NewClientAdaptor(os.Args[1])
|
|
ubit := microbit.NewLEDDriver(bleAdaptor)
|
|
|
|
work := func() {
|
|
ubit.Blank()
|
|
gobot.After(1*time.Second, func() {
|
|
ubit.WriteText("Hello")
|
|
})
|
|
gobot.After(7*time.Second, func() {
|
|
ubit.Smile()
|
|
})
|
|
}
|
|
|
|
robot := gobot.NewRobot("blinkBot",
|
|
[]gobot.Connection{bleAdaptor},
|
|
[]gobot.Device{ubit},
|
|
work,
|
|
)
|
|
|
|
robot.Start()
|
|
}
|