Home | About | Contact

Home: Electronics: Arduino

Bookmark and Share

Adruino




Click here for the code to the "Hello World" program for arduinos, the blinking LED.

I got my first Arduino board not long ago, and I finally got my first program/project working! I did the 'blinking LED' program which is said to be the “Hello World” of physical computing. (Click here for the code). I live in an out of the way place, so when I decided to do this project, I needed to find an LED. So I went to the source by circuit city in Grande Prairie, AB, (the city of which I have coined the term, Gong Prairie, because nearly everything about this place is a gong show). I was disappointed to find the cheapest LEDs at 2 for $4.00. What a rip off! Who in their right mind would buy from them! Maybe teachers who are spending taxpayers money, for class projects. Who knows.

Anyway, was at my parents searching through my dad's old junk when my brother suggested one of those little flashlights. I said “yes they do have LEDs...” when I realized in my pocket I had one of those little flat flashlights, and the battery was about dead. So I went home and took it apart and got the LED out of it. I clipped the positive (longer) wire shorter, so it would fit right into the two pins, 13 and ground. You can see this project at: http://www.arduino.cc/en/Tutorial/BlinkingLED I copied the code, and it worked. I have the ATMEGA 328, so I had to make sure I had the right chip selected, and Com 4 once the USB had finished configuring. Make sure you don't just put the LED wires in the last two pins, (because its the second last)

I was able to do the morse codes for SOS, that was neat. Here is the code example if you want:
or alternatively you can download the .pde file for direct loading into the adruino software environment.


int ledPin=13;


void setup()
{
  pinMode(ledPin, OUTPUT);
}

void loop()
{
  // S

digitalWrite(ledPin, HIGH);
delay(50);
digitalWrite(ledPin, LOW);
delay(200);

digitalWrite(ledPin, HIGH);
delay(50);
digitalWrite(ledPin, LOW);
delay(200);

digitalWrite(ledPin, HIGH);
delay(50);
digitalWrite(ledPin, LOW);
delay(200);

delay(200);

// O

digitalWrite(ledPin, HIGH);
delay(250);
digitalWrite(ledPin, LOW);
delay(200);

digitalWrite(ledPin, HIGH);
delay(250);
digitalWrite(ledPin, LOW);
delay(200);

digitalWrite(ledPin, HIGH);
delay(250);
digitalWrite(ledPin, LOW);
delay(200);

// S

digitalWrite(ledPin, HIGH);
delay(50);
digitalWrite(ledPin, LOW);
delay(200);

digitalWrite(ledPin, HIGH);
delay(50);
digitalWrite(ledPin, LOW);
delay(200);

digitalWrite(ledPin, HIGH);
delay(50);
digitalWrite(ledPin, LOW);
delay(200);

delay(5000);
}


I'd actually like to make a project that will blink the morse code for each letter of the alphabet, taking input from a keyboard.







Home | contact | about
© Copyright 2009