Flickering LED Candle by SolidSilver

Step 4: Program your chip

We'll be cutting off the unused pins of the ATtiny13, so be sure to program the chip before you do that! I use a USBtinyISP programmer and a SparkFun breakout board in a solderless breadboard. We're using the internal oscillator of the tiny13, so there's no need to burn any of the programming fuses. You can use the hex file provided or compile your own with the provided source code.

Some notes about the source code: I used a generic random number generator because the stdlib rand() function is almost twice as large. When you only have 1024 bytes of Flash memory, every byte counts! Also, the millisecond timer doesn't seem to line up with real wall-clock time. But since exact timing isn't really important in this application, I just eyeballed the timing. Purists might cringe, but I'm a pragmatist. :)

To program using the supplied hex file on a Linux system, use this command line:

avrdude -p attiny13 -P usb -c usbtiny -U flash:w:flicker.hex

WinAVR users will probably know the right incantation. I don't do Windows. :D

Update: flicker2.zip contains the second version of the code, featuring two flicker patterns (flicker-up and flicker-down), along with adding watchdog protection to reset the chip if the mainline code should freeze.
 
Remove these adsRemove these ads by Signing Up
trainables says: Mar 26, 2010. 4:03 PM
Step 4, learn Latin.  (Sorry, I don't know Latin well enough to teach you.)
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!