digiSpark
All pins can be used as Digital I/O
Pin 0 → I2C SDA, PWM (LED on Model B)
Pin 1 → PWM (LED on Model A)
Pin 2 → I2C SCK, Analog In
Pin 3 → Analog In (also used for USB+ when USB is in use)
Pin 4 → PWM, Analog (also used for USB- when USB is in use)
Pin 5 → Analog In
Sometimes P5 will be configured as RESET. To fix this follow this guide to refuse RESET as IO
http://thetoivonen.blogspot.com/2015/12/fixing-pin-p5-or-6-on-digispark-clones.html
Which boils down to:
sudo avrdude -P usb -c usbasp -p attiny85 -n
sudo avrdude -P usb -c usbasp -p attiny85 -U hfuse:w:0x5F:m
Install:
Using arduino IDE (or arduino-cli) on a PC, you should use the boardmanager
http://digistump.com/package_digistump_index.json
Install
apt-get install lib32stdc++6
Make a fix for platform.txt
## Create hex
recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} "{build.path}/{build.project_name}.elf" " {build.path}/{build.project_name}.hex"
+ ## Save hex
+ recipe.output.tmp_file={build.project_name}.hex
+ recipe.output.save_file={build.path}/{build.project_name}.{build.variant}.hex
+
## Compute size
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
recipe.size.regex=^(?:\.text|\.data|\.bootloader)\s+([0-9]+).*
Add udev rule (in file '/etc/udev/rules.d/49-micronucleus.rules') and restart with sudo udevadm control --reload-rules
# UDEV Rules for Micronucleus boards including the Digispark.
# This file must be placed at:
#
# /etc/udev/rules.d/49-micronucleus.rules (preferred location)
# or
# /lib/udev/rules.d/49-micronucleus.rules (req'd on some broken systems)
#
# After this file is copied, physically unplug and reconnect the board.
#
SUBSYSTEMS=="usb", ATTRS{idVendor}=="16d0", ATTRS{idProduct}=="0753", MODE:="0666"
KERNEL=="ttyACM*", ATTRS{idVendor}=="16d0", ATTRS{idProduct}=="0753", MODE:="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
#
# If you share your linux system with other users, or just don't like the
# idea of write permission for everybody, you can replace MODE:="0666" with
# OWNER:="yourusername" to create the device owned by you, or with
# GROUP:="somegroupname" and mange access using standard unix groups.
Using:
arduino-cli compile -b digistump:avr:digispark-tiny ~/Arduino/MyScript
arduino-cli upload -p zzz -b digistump:avr:digispark-tiny ~/Arduino/MyScript