2023-05-20 14:25:21 +02:00
|
|
|
//go:build example
|
2017-03-13 11:01:39 -04:00
|
|
|
// +build example
|
2023-05-20 14:25:21 +02:00
|
|
|
|
2017-03-13 11:01:39 -04:00
|
|
|
//
|
|
|
|
// Do not build by default.
|
|
|
|
|
2016-05-13 17:30:46 -07:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"time"
|
|
|
|
|
2023-05-20 14:25:21 +02:00
|
|
|
"gobot.io/x/gobot/v2"
|
2016-05-13 17:30:46 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
robot := gobot.NewRobot(
|
|
|
|
"hello",
|
|
|
|
func() {
|
2016-12-08 20:32:02 +01:00
|
|
|
done := gobot.Every(750*time.Millisecond, func() {
|
2016-05-13 17:30:46 -07:00
|
|
|
fmt.Println("Greetings human")
|
|
|
|
})
|
|
|
|
|
|
|
|
gobot.After(5*time.Second, func() {
|
2016-12-08 20:32:02 +01:00
|
|
|
done.Stop()
|
2016-05-13 17:30:46 -07:00
|
|
|
fmt.Println("We're done here")
|
|
|
|
})
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
2016-10-18 21:08:25 +02:00
|
|
|
robot.Start()
|
2016-05-13 17:30:46 -07:00
|
|
|
}
|