2016-05-14 08:30:46 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"time"
|
|
|
|
|
2016-12-08 20:24:03 +08:00
|
|
|
"gobot.io/x/gobot"
|
2016-05-14 08:30:46 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
robot := gobot.NewRobot(
|
|
|
|
"hello",
|
|
|
|
func() {
|
|
|
|
done := gobot.Every(500*time.Millisecond, func() {
|
|
|
|
fmt.Println("Greetings human")
|
|
|
|
})
|
|
|
|
|
|
|
|
gobot.After(5*time.Second, func() {
|
|
|
|
done <- true
|
|
|
|
fmt.Println("We're done here")
|
|
|
|
})
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
2016-10-19 03:08:25 +08:00
|
|
|
robot.Start()
|
2016-05-14 08:30:46 +08:00
|
|
|
}
|