Documentation ¶
Overview ¶
Package digispark provides the Gobot adaptor for the Digispark ATTiny-based USB development board.
Installing:
This package requires installing `libusb`. Then you can install the package with:
go get github.com/hybridgroup/gobot/platforms/digispark
Example:
package main import ( "time" "github.com/hybridgroup/gobot" "github.com/hybridgroup/gobot/platforms/digispark" "github.com/hybridgroup/gobot/platforms/gpio" ) func main() { gbot := gobot.NewGobot() digisparkAdaptor := digispark.NewDigisparkAdaptor("Digispark") led := gpio.NewLedDriver(digisparkAdaptor, "led", "0") work := func() { gobot.Every(1*time.Second, func() { led.Toggle() }) } robot := gobot.NewRobot("blinkBot", []gobot.Connection{digisparkAdaptor}, []gobot.Device{led}, work, ) gbot.AddRobot(robot) gbot.Start() }
For further information refer to digispark README: https://github.com/hybridgroup/gobot/blob/master/platforms/digispark/README.md
Index ¶
- type DigisparkAdaptor
- func (d *DigisparkAdaptor) Connect() bool
- func (d *DigisparkAdaptor) DigitalRead(pin string) int
- func (d *DigisparkAdaptor) DigitalWrite(pin string, level byte)
- func (d *DigisparkAdaptor) Finalize() bool
- func (d *DigisparkAdaptor) InitServo()
- func (d *DigisparkAdaptor) PwmWrite(pin string, value byte)
- func (d *DigisparkAdaptor) ServoWrite(pin string, angle uint8)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DigisparkAdaptor ¶
func NewDigisparkAdaptor ¶
func NewDigisparkAdaptor(name string) *DigisparkAdaptor
NewDigisparkAdaptor create a Digispark adaptor with specified name
func (*DigisparkAdaptor) Connect ¶
func (d *DigisparkAdaptor) Connect() bool
Connect starts connection to digispark, returns true if successful
func (*DigisparkAdaptor) DigitalRead ¶
func (d *DigisparkAdaptor) DigitalRead(pin string) int
DigitalRead (not yet implemented)
func (*DigisparkAdaptor) DigitalWrite ¶
func (d *DigisparkAdaptor) DigitalWrite(pin string, level byte)
DigitalWrite writes level to specified pin using littlewire
func (*DigisparkAdaptor) Finalize ¶
func (d *DigisparkAdaptor) Finalize() bool
Finalize returns true if finalization is successful
func (*DigisparkAdaptor) InitServo ¶
func (d *DigisparkAdaptor) InitServo()
InitServo (not yet implemented)
func (*DigisparkAdaptor) PwmWrite ¶
func (d *DigisparkAdaptor) PwmWrite(pin string, value byte)
PwmWrite updates pwm pin with sent value
func (*DigisparkAdaptor) ServoWrite ¶
func (d *DigisparkAdaptor) ServoWrite(pin string, angle uint8)
ServoWrite updates servo location with specified angle