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 -u -d gobot.io/x/gobot/platforms/digispark
Example:
package main import ( "time" "gobot.io/x/gobot" "gobot.io/x/gobot/drivers/gpio" "gobot.io/x/gobot/platforms/digispark" ) func main() { digisparkAdaptor := digispark.NewAdaptor() led := gpio.NewLedDriver(digisparkAdaptor, "0") work := func() { gobot.Every(1*time.Second, func() { led.Toggle() }) } robot := gobot.NewRobot("blinkBot", []gobot.Connection{digisparkAdaptor}, []gobot.Device{led}, work, ) robot.Start() }
For further information refer to digispark README: https://github.com/hybridgroup/gobot/blob/master/platforms/digispark/README.md
Index ¶
- Variables
- type Adaptor
- func (d *Adaptor) Connect() (err error)
- func (d *Adaptor) DigitalWrite(pin string, level byte) (err error)
- func (d *Adaptor) Finalize() (err error)
- func (d *Adaptor) Name() string
- func (d *Adaptor) PwmWrite(pin string, value byte) (err error)
- func (d *Adaptor) ServoWrite(pin string, angle uint8) (err error)
- func (d *Adaptor) SetName(n string)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrConnection = errors.New("connection error")
ErrConnection is the error resulting of a connection error with the digispark
Functions ¶
This section is empty.
Types ¶
type Adaptor ¶ added in v1.0.0
type Adaptor struct {
// contains filtered or unexported fields
}
Adaptor is the Gobot Adaptor for the Digispark
func NewAdaptor ¶ added in v1.0.0
func NewAdaptor() *Adaptor
NewAdaptor returns a new Digispark Adaptor
func (*Adaptor) DigitalWrite ¶ added in v1.0.0
DigitalWrite writes a value to the pin. Acceptable values are 1 or 0.
func (*Adaptor) ServoWrite ¶ added in v1.0.0
ServoWrite writes the 0-180 degree val to the specified pin.
Click to show internal directories.
Click to hide internal directories.