2014-06-10 10:01:53 +08:00
# Digispark
2014-04-26 18:11:51 +08:00
2014-11-29 07:34:42 +08:00
The Digispark is an Attiny85 based microcontroller development board similar to the Arduino line, only cheaper, smaller, and a bit less powerful. With a whole host of shields to extend its functionality and the ability to use the familiar Arduino IDE the Digispark is a great way to jump into electronics, or perfect for when an Arduino is too big or too much.
2017-06-11 05:02:09 +08:00
This package provides the Gobot adaptor for the [Digispark ](http://digistump.com/products/1 ) ATTiny-based USB development board with the [Little Wire ](http://littlewire.github.io/ ) protocol firmware installed.
2014-04-26 18:11:51 +08:00
2014-11-29 07:34:42 +08:00
## How to Install
2014-04-26 18:11:51 +08:00
2014-06-10 10:01:53 +08:00
This package requires `libusb` .
2014-04-26 18:11:51 +08:00
### OSX
2014-06-10 10:01:53 +08:00
To install `libusb` on OSX using Homebrew:
2014-04-26 18:11:51 +08:00
```
2014-08-22 17:58:26 +08:00
$ brew install libusb & & brew install libusb-compat
2014-04-26 18:11:51 +08:00
```
### Ubuntu
To install libusb on linux:
```
$ sudo apt-get install libusb-dev
```
2014-07-07 03:17:10 +08:00
Now you can install the package with
2014-11-29 07:34:42 +08:00
2014-06-10 10:01:53 +08:00
```
2017-05-27 18:19:14 +08:00
go get -d -u gobot.io/x/gobot/...
2014-06-10 10:01:53 +08:00
```
2014-04-26 18:11:51 +08:00
2014-11-29 07:34:42 +08:00
## How to Use
2014-04-26 18:11:51 +08:00
```go
package main
import (
2014-07-11 08:02:00 +08:00
"time"
2016-12-08 20:24:03 +08:00
"gobot.io/x/gobot"
"gobot.io/x/gobot/drivers/gpio"
"gobot.io/x/gobot/platforms/digispark"
2014-04-26 18:11:51 +08:00
)
func main() {
2016-09-26 02:43:09 +08:00
digisparkAdaptor := digispark.NewAdaptor()
led := gpio.NewLedDriver(digisparkAdaptor, "0")
2014-07-11 08:02:00 +08:00
work := func() {
gobot.Every(1*time.Second, func() {
led.Toggle()
})
}
2014-06-10 10:01:53 +08:00
2014-07-11 08:02:00 +08:00
robot := gobot.NewRobot("blinkBot",
[]gobot.Connection{digisparkAdaptor},
[]gobot.Device{led},
work,
)
2016-10-19 03:37:10 +08:00
robot.Start()
2014-07-11 08:02:00 +08:00
}
2014-04-26 18:11:51 +08:00
```
2017-05-27 18:19:14 +08:00
2014-11-29 07:34:42 +08:00
## How to Connect
2014-04-26 18:11:51 +08:00
2014-07-07 03:17:10 +08:00
If your Digispark already has the Little Wire protocol firmware installed, you can connect right away with Gobot.
2014-04-26 18:11:51 +08:00
2017-05-27 18:19:14 +08:00
Otherwise, you must first flash your Digispark with the Little Wire firmware.
The easiest way to flash your Digispark is to use Gort [https://gort.io ](https://gort.io ).
Download and install Gort, and then use the following commands:
Then, install the needed Digispark firmware.
```
gort digispark install
```
2014-04-26 18:11:51 +08:00
### OSX
2014-06-10 10:01:53 +08:00
2017-05-27 18:19:14 +08:00
**Important**: 2012 MBP The USB ports on the 2012 MBPs (Retina and non) cause issues due to their USB3 controllers,
currently the best work around is to use a cheap USB hub (non USB3).
Plug the Digispark into your computer via the USB port and run:
2014-04-26 18:11:51 +08:00
```
2017-05-27 18:19:14 +08:00
gort digispark upload littlewire
2014-04-26 18:11:51 +08:00
```
### Ubuntu
2017-05-27 18:19:14 +08:00
Ubuntu requires an extra one-time step to set up the Digispark for communication with Gobot. Run the following command:
2014-04-26 18:11:51 +08:00
2017-05-27 18:19:14 +08:00
```
gort digispark set-udev-rules
```
You might need to enter your administrative password. This steps adds a udev rule to allow access to the Digispark device.
Once this is done, you can upload Little Wire to your Digispark:
2014-04-26 18:11:51 +08:00
```
2017-05-27 18:19:14 +08:00
gort digispark upload littlewire
2014-04-26 18:11:51 +08:00
```
2017-05-27 18:19:14 +08:00
### Windows
We need instructions here, because it supposedly works.
### Manual instructions
For manual instructions on how to install Little Wire on a Digispark check out http://digistump.com/board/index.php/topic,160.0.html
2014-04-26 18:11:51 +08:00
Thanks to [@bluebie ](https://github.com/Bluebie ) for these instructions! (https://github.com/Bluebie/micronucleus-t85/wiki/Ubuntu-Linux)
2014-07-11 08:02:00 +08:00
Now plug the Digispark into your computer via the USB port.