Re-Programming the LilyTiny / LilyTwinkle
Contributors:
bri_huang
Notes on Programming the ATtiny85
The ATtiny85 isn’t your everyday Arduino microcontroller. It packs a lot of punch for its small size.
The following Arduino commands should be supported:
- pinMode()
- digitalWrite()
- digitalRead()
- analogRead()
- analogWrite()
- shiftOut()
- pulseIn()
- millis()
- micros()
- delay()
- delayMicroseconds()
- SoftwareSerial
All 5 pins are general purpose digital I/Os (GPIO). This means that they can be used with both digitalWrite() and digitalRead().
Pins 0 and 1 support PWM output (analogWrite).
Pins 2, 3, & 4 are tied to A/D on the chip (analogRead).
While the ATtiny85 supports most of the things you need, there are some things it can’t do.
No Hardware Serial (UART)
The ATtiny85 does not have a built in hardware UART. If you try to compile any Arduino code with Serial.begin()
or Serial.print()
you’ll get an error. However, there is a work around for this -- using Software Serial. This tutorial shows an example of how to do this:
Tip: Looking for a quick reference guide for the ATtiny85? Click on the link below to download an image or PDF version from our resources!