hybridgroup.gobot/examples/digispark_api.go

34 lines
579 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() {
master := gobot.NewMaster()
api.NewAPI(master).Start()
digisparkAdaptor := digispark.NewAdaptor()
led := gpio.NewLedDriver(digisparkAdaptor, "0")
robot := gobot.NewRobot("digispark",
[]gobot.Connection{digisparkAdaptor},
[]gobot.Device{led},
)
master.AddRobot(robot)
if err := master.Start(); err != nil {
panic(err)
}
}