This article presents a C++ class that implements an auto-repeat button. An auto-repeat button behaves like a key on a keyboard. That is, it fires first when you press it and then repeatedly when you hold it down. The class allows you to configure the length of time that the button waits...
Debouncing buttons in AVR C++
posted by Andy
On the face of it, reading the open/closed state of a button should be straightforward. You would just wire up the button circuit and tap the current flow into one of the Arduino digital pins configured for input. Unfortunately you will soon discover that it’s just not that simple. At...
avr-gcc 4.5.1 and avr-libc 1.7.0 for windows
posted by Andy
Deprecated! This has now been superceded by gcc-4.7.0 and avr-libc 1.8.0. Click here to go to my article that describes how to upgrade. The version of gcc included with WinAVR-20100110 is 4.3.3. If you’d like to update to avr-gcc 4.5.1 with avr-libc 1.7.0 then you’ve come to...
Your first AVR project in Eclipse
posted by Andy
So you’ve read my blog post Setting up Eclipse for AVR projects and now you want to write some code but you’re somewhat bewildered by all the Eclipse options. Well not to worry, I’ll walk you through your first project step-by-step. We’ll go ahead and recreate the...
Recommended avr-gcc compiler settings
posted by Andy
It can be daunting when you first set up a project in Eclipse and you start browsing the available compiler options. There are just so many it’s not even funny. The aim of this article is to show you which options you should change, and what you should change them to in order to get the...
The global constructor bug in avr-gcc
posted by Andy
There is a major bug affecting versions of avr-gcc that I have tested from 4.4 all the way up to the most recent (at the time of writing) 4.5.1. It only affects programs that target MCUs with more than 64K flash memory so you need to know about this if you are programming the Arduino Mega...
The Arduino library compiled and ready for linking
posted by Andy
When you compile your ‘sketch’ with the Arduino IDE one of the steps it takes is to quietly compile, on-the-fly, all the library files that supply the popular classes and functions such as Serial, digitalWrite, analogWrite etc. The reason the IDE does it like this is because the...
Setting up Eclipse for AVR projects
posted by Andy
For many hobbyists the first AVR integrated development environment (IDE) that they will encounter will be the Arduino IDE. The Ardunio IDE goes out of its way to make it easy for you to quickly bash out test code and get it up and running as fast as possible without having to worry too much...