As you might recall from the last post, we can flash hex files on our AVR. But what are hex files? Hex files are “machine language” instructions for your AVR’s. With this, your chip knows how to respond to inputs just like you want it to. It’s the same as the .exe is for Windows. People with knowledge in programming and building your code can probably skip this post, since it is likely that you already know all this.
To write our code, and obtain our hex files, we’ll need some tools to work with. These tools depend on your choice of operating system.
The first step of the programming walk through is writing your code. Sure enough, you could just write it in notepad, but we don’t need to be that hardcore. Windows users have a great tool to get all the work out of their hands: Atmel Studio 6. This is a great way to quickly start and end your projects, with few problems in between. Plus, it’s free. So, win-win. Since Atmel Studio is an all-in-one IDE, you won’t need anything else.
After the download and the install (straightforward process), you can start it. Just name your project, choose your hardware from the list included by default, and get to the coding. After you’re done, just press F7 or go to Build > Build Solution. This will compile and build your code, giving you access to the .hex file, that should now be in your Documents folder, inside the folder “Atmel Studioyour_projectyour_projectdebug”.
Once you have it, you can proceed flashing it to your chip, using your favorite programmer.