gobot: gobot.io/x/gobot/platforms/digispark Index | Files

package digispark

import "gobot.io/x/gobot/platforms/digispark"

Package digispark provides the Gobot adaptor for the Digispark ATTiny-based USB development board.


This package requires installing `libusb`. Then you can install the package with:

go get -u -d gobot.io/x/gobot/platforms/digispark


package main

import (


func main() {
	digisparkAdaptor := digispark.NewAdaptor()
	led := gpio.NewLedDriver(digisparkAdaptor, "0")

	work := func() {
		gobot.Every(1*time.Second, func() {

	robot := gobot.NewRobot("blinkBot",


For further information refer to digispark README: https://github.com/hybridgroup/gobot/blob/master/platforms/digispark/README.md


Package Files

digispark_adaptor.go digispark_i2c.go doc.go littleWire.go


var ErrConnection = errors.New("connection error")

ErrConnection is the error resulting of a connection error with the digispark

func NewDigisparkI2cConnection Uses

func NewDigisparkI2cConnection(adaptor *Adaptor, address uint8) (connection *digisparkI2cConnection)

NewDigisparkI2cConnection creates an i2c connection to an i2c device at the specified address

type Adaptor Uses

type Adaptor struct {
    // contains filtered or unexported fields

Adaptor is the Gobot Adaptor for the Digispark

func NewAdaptor Uses

func NewAdaptor() *Adaptor

NewAdaptor returns a new Digispark Adaptor

func (*Adaptor) Connect Uses

func (d *Adaptor) Connect() (err error)

Connect starts a connection to the digispark

func (*Adaptor) DigitalWrite Uses

func (d *Adaptor) DigitalWrite(pin string, level byte) (err error)

DigitalWrite writes a value to the pin. Acceptable values are 1 or 0.

func (*Adaptor) Finalize Uses

func (d *Adaptor) Finalize() (err error)

Finalize implements the Adaptor interface

func (*Adaptor) GetConnection Uses

func (d *Adaptor) GetConnection(address int, bus int) (connection i2c.Connection, err error)

GetConnection returns an i2c connection to a device on a specified bus. Only supports bus number 0

func (*Adaptor) GetDefaultBus Uses

func (d *Adaptor) GetDefaultBus() int

GetDefaultBus returns the default i2c bus for this platform

func (*Adaptor) Name Uses

func (d *Adaptor) Name() string

Name returns the Digispark Adaptors name

func (*Adaptor) PwmWrite Uses

func (d *Adaptor) PwmWrite(pin string, value byte) (err error)

PwmWrite writes the 0-254 value to the specified pin

func (*Adaptor) ServoWrite Uses

func (d *Adaptor) ServoWrite(pin string, angle uint8) (err error)

ServoWrite writes the 0-180 degree val to the specified pin.

func (*Adaptor) SetName Uses

func (d *Adaptor) SetName(n string)

SetName sets the Digispark Adaptors name

Package digispark imports 6 packages (graph). Updated 2018-08-28. Refresh now. Tools for package owners.