2014-10-21 01:17:47 +08:00
|
|
|
/*
|
2014-10-29 05:52:59 +08:00
|
|
|
Package digispark provides the Gobot adaptor for the Digispark ATTiny-based USB development board.
|
2014-10-21 01:17:47 +08:00
|
|
|
|
|
|
|
Installing:
|
|
|
|
|
|
|
|
This package requires installing `libusb`.
|
|
|
|
Then you can install the package with:
|
|
|
|
|
2014-10-29 05:52:59 +08:00
|
|
|
go get github.com/hybridgroup/gobot/platforms/digispark
|
2014-10-21 01:17:47 +08:00
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/hybridgroup/gobot"
|
2016-09-26 02:43:09 +08:00
|
|
|
"github.com/hybridgroup/gobot/drivers/gpio"
|
2016-10-19 03:37:10 +08:00
|
|
|
"github.com/hybridgroup/gobot/platforms/digispark"
|
2014-10-21 01:17:47 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2016-09-26 02:43:09 +08:00
|
|
|
digisparkAdaptor := digispark.NewAdaptor()
|
|
|
|
led := gpio.NewLedDriver(digisparkAdaptor, "0")
|
2014-10-21 01:17:47 +08:00
|
|
|
|
|
|
|
work := func() {
|
|
|
|
gobot.Every(1*time.Second, func() {
|
|
|
|
led.Toggle()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
robot := gobot.NewRobot("blinkBot",
|
|
|
|
[]gobot.Connection{digisparkAdaptor},
|
|
|
|
[]gobot.Device{led},
|
|
|
|
work,
|
|
|
|
)
|
|
|
|
|
2016-10-19 03:37:10 +08:00
|
|
|
robot.Start()
|
2014-10-21 01:17:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
For further information refer to digispark README:
|
|
|
|
https://github.com/hybridgroup/gobot/blob/master/platforms/digispark/README.md
|
|
|
|
*/
|
|
|
|
package digispark
|