week six

embedded programming


programming the milk jug board

For this assignment, since I had an led and a tactile button on my hello world milk jug board from week four, I decided to make the led light up on button pushes. I wrote my code in Arduino, and uploaded it to my board. You'll find a video at the bottom of this section of it working!

w6code

button led Arduino code

Because we aren't using an actual Arduino board, I searched up the ATtiny44 to Arduino pin outs. This was a handy diagram that I found (the corresponding Arduino pins are in brown):

attiny44_pins

ATtiny44 to Arduino pins

It's good to note that in order to upload code using Arduino through a programmer, the settings under "tools" must be correct to whatever setup you're using. For me, I used a 20MHz clock, ATtiny44 board, ATtiny44 processor, USB port, and Atmel ICE programmer. You'll also want to make sure your programmer's is hooked up to your ISP header in the correct orientation.

icsp_6pin

Atmel ICE pins

videos: button led


important notes

I didn't pay close enough attention to the week four hello world programming when Anthony helped me with it, and that led to some misconceptions that really showed while trying to program my boards independently for my final project. Because this week was a bit shorter, I'll put the information that I clarified during my final project (a little too late in the game, honestly) where it feels applicable (so, this week)!

My misconception: using the terminal commands to program a board is a form of "setting up" the board so that I can later upload code to it through a medium that I understand a little better (like Arduino). Running the make and make fuses commands is necessary to do before even trying to upload code to the board.

In reality: using the terminal commands to program a board does the same thing as using "upload using programmer" in Arduino. It programs the boards/uploads whatever code you want to the microcontroller, which is why you need to use the correct .c.make file for the microcontroller on our board when using the terminal method to upload code through a programmer like the Atmel ICE.

So, in the future, here's an easy guide on what to do when you want to upload code to a board USING THE TERMINAL:

If you're uploading using the programmer THROUGH ARDUINO, it's really simple. Just write code like you normally would and check the settings under the "tools" tab to make sure it's on the correct clock, board, processor, port, and programmer. Then, hit "upload using programmer" (or just upload), and you should be good to go!