2014-10-20 12:17:47 -05:00
|
|
|
/*
|
2014-10-28 14:52:59 -07:00
|
|
|
Package digispark provides the Gobot adaptor for the Digispark ATTiny-based USB development board.
|
2014-10-20 12:17:47 -05:00
|
|
|
|
|
|
|
Installing:
|
|
|
|
|
|
|
|
This package requires installing `libusb`.
|
|
|
|
Then you can install the package with:
|
|
|
|
|
2023-06-04 18:36:55 +02:00
|
|
|
Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md)
|
2014-10-20 12:17:47 -05:00
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2023-05-20 14:25:21 +02:00
|
|
|
"gobot.io/x/gobot/v2"
|
|
|
|
"gobot.io/x/gobot/v2/drivers/gpio"
|
|
|
|
"gobot.io/x/gobot/v2/platforms/digispark"
|
2014-10-20 12:17:47 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2016-09-25 20:43:09 +02:00
|
|
|
digisparkAdaptor := digispark.NewAdaptor()
|
|
|
|
led := gpio.NewLedDriver(digisparkAdaptor, "0")
|
2014-10-20 12:17:47 -05:00
|
|
|
|
|
|
|
work := func() {
|
|
|
|
gobot.Every(1*time.Second, func() {
|
2024-02-11 15:34:50 +01:00
|
|
|
if err := led.Toggle(); err != nil {
|
|
|
|
fmt.Println(err)
|
|
|
|
}
|
2014-10-20 12:17:47 -05:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
robot := gobot.NewRobot("blinkBot",
|
|
|
|
[]gobot.Connection{digisparkAdaptor},
|
|
|
|
[]gobot.Device{led},
|
|
|
|
work,
|
|
|
|
)
|
|
|
|
|
2024-02-11 15:34:50 +01:00
|
|
|
if err := robot.Start(); err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2014-10-20 12:17:47 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
For further information refer to digispark README:
|
2024-02-13 15:58:31 +01:00
|
|
|
https://github.com/hybridgroup/gobot/blob/release/platforms/digispark/README.md
|
2014-10-20 12:17:47 -05:00
|
|
|
*/
|
2023-05-20 14:25:21 +02:00
|
|
|
package digispark // import "gobot.io/x/gobot/v2/platforms/digispark"
|