Program ATTiny85 with Arduino IDEMar 6th 2021Words: 544
I bought a $1 Chinese version Digispark ATTiny85 kit.
Step
Open Arduino IDE, in File > Settings > Additional Boards Manager URLs, add https://raw.githubusercontent.com/ArminJo/DigistumpArduino/master/package_digistump_index.json and save.
In Tools > Board > Boards Manager, search and install digistump AVR Boards.
Select the Digispark Default 16.5MHz board and Micronucleus programmer.
Write some example codes, for example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#define LED_PIN 1
voidsetup(){ // put your setup code here, to run once: pinMode(LED_PIN, OUTPUT); }
voidloop(){ // put your main code here, to run repeatedly: digitalWrite(LED_PIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(LED_PIN, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second }
Click upload, then plug in the board according to the hint.
Micronucleus and bootloader update
While uploading, my version of board throws the following error:
1 2 3
Warning: device with unknown new version of Micronucleus detected. This tool doesn't know how to upload to this new device. Updates may be available. Device reports version as: 2.2
Update micronucleus
Compile the micronucleus cli from GitHub - micronucleus, or download from its release page
Overwrite the old version in ~/.arduino15/packages/digistump/tools/micronucleus/
Now try to uplaod the code again.
In case of permission error:
1
Permission denied. For Linux, copy file https://github.com/micronucleus/micronucleus/blob/master/commandline/49-micronucleus.rules to /etc/udev/rules.d