Travis Rich -- HTMAA

week 1 Proposal
week 2 Press Fit
week 3 FabISP
week 4 3D
week 5 PCB
week 6 Casting
week 7 ATtiny
week 8 Big
week 9 Input
week 10 Epoxy
week 11 Output
week 12 Interface
week 13 Network
week 14 Machine
week 15 Final

Week 7 -- Programming

10/22/12

Introduction

This week we're programming the boards we had previously made in week 5. My board at the time was designed with two LEDS (in the place of eyes) and a single button (in the place of a nose). While there was also the option of building a new Fabduino this week, I stuck with programming my older board, due to the time constraints of the upcoming sponsor week.

Bootloading

I first tried bootloading through the Arduino environment, following Dave Mellis' tutorial. This worked for me using an AVR ISP, but unfortunately I wasn't able to have my device recognized by the Arduino environment when I tried to do the programming in this domain. I switched to a slightly lower level approach to all of this and began to use Neil's quick steps that are shown here. This eventually worked for me and I was able to get the term.py working - verifying that everything had gone accordingly. I did run into a few issues along the way though. The first seemed to be based on the order in which I connected the ISP and the FTDI cables. I found that unplugging both, then plugging in the ISP 3x2 header and then the FTDI cable gave good results. Other orders seemed to leave me with a 'device not found' error. Another error I kept running into came when running term.py: "ImportError: No module named tkinter". I tried a few solutions on my mac side, but eventually gave up, booted into Ubuntu and tried to run term.py from there. I got the same error again, but was able to fix everything by simply installing python-tk: "sudo apt-get install python-tk".

Programming

I took a first step in programming by editing the hello.arduino.168.blink.c file. I updated the variables to point to the correct pin on my board and after a small amount of struggle (I didn't realize DDRB needed to be changed to DDRA), my board started blinking! I then tried to get my board to turn on the LEDs with the push of the button. For this, I follow the lead of hello.button.45.c. This implemented relatively quickly, but the button seems to have some serious debouncing issues. I got around this by just setting a 1000ms delay after the button is first pressed. This sets the LED to stay on for 1s and gets around any pesky bouncing issues. In future efforts though, an actual debouncer will be used. It also seems like stray capacative effects are triggering the button pin to toggle errantly at times.

Files

My final code used to make the board blink at the push of the button is linked here: blinkOnButton.c