Skip to content

Instantly share code, notes, and snippets.

@BjoernSchilberg
Last active January 21, 2023 13:30
Show Gist options
  • Save BjoernSchilberg/4aff58f1a6c14f5fe60219db2c997248 to your computer and use it in GitHub Desktop.
Save BjoernSchilberg/4aff58f1a6c14f5fe60219db2c997248 to your computer and use it in GitHub Desktop.
attiny85

attiny85

[...
It’s an 8-bit processor with only 8k of RAM.

And you can do more than just blink an LED. You can control a whole WS2812 strip
of RGB LEDs, and do other neat things. So it’s incredible what you can do with
8k of RAM.
[...]

Source: https://changelog.com/gotime/199

Hardware

USB Permission

# 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.
sudo udevadm control --reload-rules

arduino

Edit ~/.arduino15/packages/digistump/hardware/avr/1.6.7/platform.txt.

In AVR Uploader/Programmers tools change:

tools.micronucleus.upload.pattern="{cmd.path}" --run --timeout 60 "{build.path}/{build.project_name}.hex"
#tools.micronucleus.upload.pattern="{cmd.path}" -cdigispark --timeout 60 -Uflash:w:{build.path}/{build.project_name}.hex:i

Replace arduino15/packages/digistump/tools/micronucleus/2.0a4/micronucleus with new version from https://github.com/micronucleus/micronucleus.

Test with sketch:

void setup() {
pinMode(1, OUTPUT);
}

void loop() {
digitalWrite(1,HIGH);
delay(300);
digitalWrite(1,LOW);
delay(300);
}

go

package main

import (
 "machine"
 "time"
)

func main() {
 led := machine.LED
 led.Configure(machine.PinConfig{Mode: machine.PinOutput})
 for {
  led.Low()
  time.Sleep(time.Millisecond * 100)
  led.High()
  time.Sleep(time.Millisecond * 100)
 }
}
export PATH=$PATH:/usr/local/go/bin
export PATH=$PATH:~/software/arduino-1.8.16/hardware/tools/avr/bin
go mod init blinky
tinygo flash -target=digispark

Solar

Tips & Tricks

Projects

Links

Software

Game consoles

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment