natalie haddad
fab academy 2012

embedded programming

programming hello.echo board with arduino

initially i began by downloading arduino 1.0 and the ATtiny board files from the GitHub repository. Then i was able to program with the FabISP through arduino to Attiny44 (external 20MHz clock). I initially tried to make it work on both Ubuntu and then windows, but ran into problems with my FTDI cable reading properly so it was done on the mac side.

then i burned the bootloader. next i changed the pin numbers so they would correspond to where i located the LED and the button on the board. the button pin was #3, and the LED pin was #7.

I downloaded the code example and copied it into the arduino sketch:

/* LED Off Until Button Pressed Blinks a light emitting diode(LED) connected to digital pin 7, when pressing a pushbutton attached to pin 3. The circuit: * LED attached from pin 7 to ground * pushbutton attached to pin 3 from +5V * 10K resistor attached to pin 3 to +5V * 10K resistor pulls pin 3 and the button to HIGH by default created 2005 by DojoDave modified 30 Aug 2011 by Tom Igoe modified for Hello Button + LED Board - 19 Mar 2012 by Anna Kaziunas France */ // constants won't change. // They're used here to set pin numbers: const int buttonPin = 3; // the number of the pushbutton pin const int ledPin = 7; // the number of the LED pin // initialize variables: int buttonState = 0; // variable for reading the pushbutton status void setup() { // initialize the LED pin as an output: pinMode(ledPin, OUTPUT); // initialize the pushbutton pin as an input: pinMode(buttonPin, INPUT); } void loop(){ // read the state of the pin the pushbutton is connected to: buttonState = digitalRead(buttonPin); // is the push button pressed? // if not pressed - the button state is HIGH // the pull up resistor the button / pin 3 makes the button state HIGH by default. if (buttonState == HIGH) { // turn LED off (LED is off by default) digitalWrite(ledPin, LOW); } //otherwise..... // button is pressed else { // turn LED on: digitalWrite(ledPin, HIGH); } }

i then verified the code in arudino, and uploaded it. I successfully programmed the board so when the button is pressed the LED turns on and when the button is released, the LED turns off.