mirror of
https://github.com/hybridgroup/gobot.git
synced 2025-05-02 22:17:12 +08:00
39 lines
531 B
Go
39 lines
531 B
Go
package main
|
|
|
|
import (
|
|
. "gobot"
|
|
"time"
|
|
"fmt"
|
|
)
|
|
|
|
func main() {
|
|
|
|
connections := []Connection{
|
|
Connection {
|
|
Name: "arduino",
|
|
Adaptor: "arduino",
|
|
Port: "/dev/ttyACM0",
|
|
},
|
|
}
|
|
|
|
devices := []Device{
|
|
Device{
|
|
Name: "led",
|
|
Driver: "arduino",
|
|
Pin: "13",
|
|
},
|
|
}
|
|
|
|
work := func(){
|
|
Every(300 * time.Millisecond, func(){ fmt.Println("Greetings Human")})
|
|
}
|
|
|
|
robot := Robot{
|
|
Connections: connections,
|
|
Devices: devices,
|
|
Work: work,
|
|
}
|
|
|
|
robot.Start()
|
|
}
|