AVR Night Light

An ATTiny2313 powers this night light, driving multicolor LEDs diffused by ping-pong balls. nuumio writes:

Geir’s RGB night light was such an inspiration I just had to make my own.  Instead of Picaxes I decided to use ATTiny 2313. At first I tried to program it with C but I ran to some “differences of opinions” with gcc when I tried to assign dedicated registers to variables holding duty cycle values (for speed optimizations). After some struggling  I gave up and coded the whole thing in AVR assembly. I was quite surprised how easy it was after all. It took me about one weekend and I got first versions running nicely.

Great job, nuumio!


Have an amazing project to share? The Electronics Show and Tell is every Wednesday at 7:30pm ET! To join, head over to YouTube and check out the show’s live chat and our Discord!

Join us every Wednesday night at 8pm ET for Ask an Engineer!

Join over 38,000+ makers on Adafruit’s Discord channels and be part of the community! http://adafru.it/discord

CircuitPython – The easiest way to program microcontrollers – CircuitPython.org


New Products – Adafruit Industries – Makers, hackers, artists, designers and engineers! — New Products 11/15/2024 Featuring Adafruit bq25185 USB / DC / Solar Charger with 3.3V Buck Board! (Video)

Python for Microcontrollers – Adafruit Daily — Python on Microcontrollers Newsletter: A New Arduino MicroPython Package Manager, How-Tos and Much More! #CircuitPython #Python #micropython @ThePSF @Raspberry_Pi

EYE on NPI – Adafruit Daily — EYE on NPI Maxim’s Himalaya uSLIC Step-Down Power Module #EyeOnNPI @maximintegrated @digikey

Adafruit IoT Monthly — The 2024 Recap Issue!

Maker Business – Adafruit Daily — Apple to build another chip at TSMC Arizona

Electronics – Adafruit Daily — SMT Tip – Stop moving around!

Get the only spam-free daily newsletter about wearables, running a "maker business", electronic tips and more! Subscribe at AdafruitDaily.com !


1 Comment

  1. Beware of circumventing gcc’s optimization engine. It’s better than you think it is.

    Personally, I wouldn’t have jumped over assembly for this. You could simply let the compiler do the optimizations and give it the additional -E flag to tell gcc to output the equivalent assembly code. You could then review the output to determine if going the assembly route was really worth it (probably not, in my experience).

    Nice project though.

Sorry, the comment form is closed at this time.