Originally written in January 2021.
Originally written for macOS Big Sur 11.1
Board used for this guide is the Kickstarter version.
Version at the time of writing is 1.8.13
a) Downloading the .app
: https://www.arduino.cc/en/software
b) Using Homebrew
$ brew install --cask arduino
- Update board source In Arduino IDE, go to File -> Preferences and dump the following into the Additional Boards Manager URLs box:
http://digistump.com/package_digistump_index.json
-
Install the Digistump AVR Boards Still in Arduino IDE, go to Tools -> Board -> Boards Manager. From the Type dropdown, select Contributed. Select the Digistump AVR Boards package and click install.
-
Set the Digistump AVR Boards as the default board Still in Arduino IDE, go to Tools -> Board -> Digitump AVR Boards -> Digispark (Default - 16.5mhz).
- Paste the following into the sketch present in Arduino IDE:
#include "DigiKeyboard.h"
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
DigiKeyboard.delay(2000);
DigiKeyboard.sendKeyStroke(0);
DigiKeyboard.sendKeyStroke(KEY_SPACE, MOD_GUI_LEFT);
DigiKeyboard.delay(600);
DigiKeyboard.print("Hello, World!");
DigiKeyboard.sendKeyStroke(KEY_ENTER);
for(;;){ /*empty*/ }
}
When this script executes through the board, it will simply open a Spotlight Search, enter "Hello, World!" and press Enter.
- Verify the script before you upload it, by clicking "Verify" in the top-left corner (alternately, Sketch -> Verify/compile).
If all is well, you should see the following output in the console at the bottom:
Sketch uses 2700 bytes (44%) of program storage space. Maximum is 6012 bytes.
Global variables use 95 bytes of dynamic memory.
NB: However, if you experience the following error:
fork/exec /Users/XXXXX/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino5/bin/avr-g++: bad CPU type in executable
Error compiling for board Digispark (Default - 16.5mhz).
The solution is to substitute (link) the built-in, outdated AVR tools that Digistump config looks for, with the new, updated one included in the Arduino IDE (Thanks to user Anjin from the Digistump boards). It is done in the following way:
For Arduino IDE 1.x:
$ cd ~/Library/Arduino15/packages/arduino/tools/avr-gcc
$ mv 4.8.1-arduino5 orig.4.8.1
$ ln -s /Applications/Arduino.app/Contents/Java/hardware/tools/avr 4.8.1-arduino5
For Arduino IDE 2.x (thanks to @jorgezazo and vgenov-py):
$ cd ~/Library/Arduino15/packages/arduino/tools/avr-gcc
$ mv 4.8.1-arduino5/ orig.4.8.1
$ ln -s ~/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7 4.8.1-arduino5
Once the script can be verified with no issues (as per step 4), prepare the Digispark ATTINY85 board.
- From the Arduino IDE, click "Upload" in the top left, and wait for the prompt:
Running Digispark Uploader...
Plug in device now... (will timeout in 60 seconds)
-
Plug in the board and wait.
-
The following should be displayed in the Arduino console, and the script should self-execute on the machine:
> Device is found!
connecting: 16% complete
connecting: 22% complete
connecting: 28% complete
connecting: 33% complete
> Device has firmware version 1.6
> Available space for user applications: 6012 bytes
> Suggested sleep time between sending pages: 8ms
> Whole page count: 94 page size: 64
> Erase function sleep duration: 752ms
parsing: 50% complete
> Erasing the memory ...
erasing: 55% complete
erasing: 60% complete
erasing: 65% complete
> Starting to upload ...
writing: 70% complete
writing: 75% complete
writing: 80% complete
> Starting the user app ...
running: 100% complete
>> Micronucleus done. Thank you!
Has anyone had a problem with the Mac M1 not recognizing it on the serial port? It doesn't appear to be selected even after installing the lib