34 lines
584 B
Go
34 lines
584 B
Go
//go:build example
|
|
// +build example
|
|
|
|
//
|
|
// Do not build by default.
|
|
|
|
package main
|
|
|
|
import (
|
|
"gobot.io/x/gobot/v2"
|
|
"gobot.io/x/gobot/v2/api"
|
|
"gobot.io/x/gobot/v2/drivers/gpio"
|
|
"gobot.io/x/gobot/v2/platforms/digispark"
|
|
)
|
|
|
|
func main() {
|
|
manager := gobot.NewManager()
|
|
api.NewAPI(manager).Start()
|
|
|
|
digisparkAdaptor := digispark.NewAdaptor()
|
|
led := gpio.NewLedDriver(digisparkAdaptor, "0")
|
|
|
|
robot := gobot.NewRobot("digispark",
|
|
[]gobot.Connection{digisparkAdaptor},
|
|
[]gobot.Device{led},
|
|
)
|
|
|
|
manager.AddRobot(robot)
|
|
|
|
if err := manager.Start(); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|