gobot.io/x/gobot/v2@v2.1.0/platforms/digispark/README.md (about) 1 # Digispark 2 3 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. 4 5 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. 6 7 ## How to Install 8 9 This package requires `libusb`. 10 11 ### OSX 12 13 To install `libusb` on OSX using Homebrew: 14 15 ``` 16 $ brew install libusb && brew install libusb-compat 17 ``` 18 19 ### Ubuntu 20 21 To install libusb on linux: 22 23 ``` 24 $ sudo apt-get install libusb-dev 25 ``` 26 27 Now you can install the package with 28 29 ``` 30 go get -d -u gobot.io/x/gobot/v2/... 31 ``` 32 33 ## How to Use 34 35 ```go 36 package main 37 38 import ( 39 "time" 40 41 "gobot.io/x/gobot/v2" 42 "gobot.io/x/gobot/v2/drivers/gpio" 43 "gobot.io/x/gobot/v2/platforms/digispark" 44 ) 45 46 func main() { 47 digisparkAdaptor := digispark.NewAdaptor() 48 led := gpio.NewLedDriver(digisparkAdaptor, "0") 49 50 work := func() { 51 gobot.Every(1*time.Second, func() { 52 led.Toggle() 53 }) 54 } 55 56 robot := gobot.NewRobot("blinkBot", 57 []gobot.Connection{digisparkAdaptor}, 58 []gobot.Device{led}, 59 work, 60 ) 61 62 robot.Start() 63 } 64 ``` 65 66 ## How to Connect 67 68 If your Digispark already has the Little Wire protocol firmware installed, you can connect right away with Gobot. 69 70 Otherwise, you must first flash your Digispark with the Little Wire firmware. 71 72 The easiest way to flash your Digispark is to use Gort [https://gort.io](https://gort.io). 73 74 Download and install Gort, and then use the following commands: 75 76 Then, install the needed Digispark firmware. 77 78 ``` 79 gort digispark install 80 ``` 81 82 ### OSX 83 84 **Important**: 2012 MBP The USB ports on the 2012 MBPs (Retina and non) cause issues due to their USB3 controllers, 85 currently the best work around is to use a cheap USB hub (non USB3). 86 87 Plug the Digispark into your computer via the USB port and run: 88 89 ``` 90 gort digispark upload littlewire 91 ``` 92 93 ### Ubuntu 94 95 Ubuntu requires an extra one-time step to set up the Digispark for communication with Gobot. Run the following command: 96 97 ``` 98 gort digispark set-udev-rules 99 ``` 100 101 You might need to enter your administrative password. This steps adds a udev rule to allow access to the Digispark device. 102 103 Once this is done, you can upload Little Wire to your Digispark: 104 105 ``` 106 gort digispark upload littlewire 107 ``` 108 109 ### Windows 110 111 We need instructions here, because it supposedly works. 112 113 ### Manual instructions 114 115 For manual instructions on how to install Little Wire on a Digispark check out http://digistump.com/board/index.php/topic,160.0.html 116 117 Thanks to [@bluebie](https://github.com/Bluebie) for these instructions! (https://github.com/Bluebie/micronucleus-t85/wiki/Ubuntu-Linux) 118 119 Now plug the Digispark into your computer via the USB port.