Okay, I'll admit that right now the flickering LED doesn't look all of interesting. I'm brainstorming ways to make it more interesting. The journey on the other hand is a bit more interesting, and I'll be talking about what I learned in the project details and I'll talk about some of what I learned here.
Creating the program has been a good refresher as it involves things such as interrupts, ADCs, hysteresis, the watchdog timer, and more.
I did create something somewhat similar a while back under the Arduino IDE but for this project I went with using the AVR-GCC toolchain directly for a few reasons. The first reason is program size. While the Arduino IDE is very convenient to get things up and running, that conveniencence does come at a price: generally larger compiled program size in comparison to using AVR-GCC. You can make things a bit leaner by doing mostly coding things in the same way that you would under AVR-GCC such as direct port manipulation.
As I test, I decided to to a comparison of my program size at the time of this writing under both AVR-GCC and and the Arduino IDE. I did have to make a few slight modifications for it to work under the Arduino IDE but here are the end results:
AVR-GCC compiled size: 978 bytes
Arduino IDE compiled size: 1190 bytes
The Arduino IDE compiled program size is about 22% larger vs compiling it under AVR-GCC which isn't too bad but the binary generated by the Arduino IDE would clearly puts me over the HaD 1kB size limit. Now if I started using the things that you typically use under the Arduino IDE such as pinMode() it would have been much worse and I may do a demonstration of this in a later project log.
Another reason I decided to use AVR-GCC is to gain a deeper understanding of AVR microcontrollers. Under the Arduino IDE I can easily do a lot without reading the datasheet for the Attiny85, but using AVR-GCC makes me rummage though the datasheet which results me in learning some interesting things. I learned about the internal temperature sensor in the Attiny85 when I was reading up on ADC. I also learned that there is much more to PWM than what analogWrite() provides.
Anyways this project log has gotten pretty long, so I'll end it here.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.