It’s hard to believe how rewarding it can be making something this pointless! This is my version of “Hello World” on the Arduino. Instead of just flashing an LED on and off, this variation flashes a three-letter Morse code navaid identifier (something familiar to aviators).

The Arduino is a wonderful new open-source physical computing platform and programming environment. It is based on the Atmel ATmega8 microcontroller, and is cheap and easy to learn. Microcontrollers can be used in everything from automation and robotics to interactive art projects. Get the skinny at http://arduino.cc/.

Here’s a (silent) video of the Morse LED flasher. See if you can guess the identifier! (Try not to fall asleep watching the blinkety-blinks.)

The code (abridged):

/* LED morse code blink
 * ------------
 *
 * Blinks an LED connected to a digital pin.
 * Pin 13 on the Arduino board is used because
 * it has a resistor attached to it, needing only an LED
 *
 */

  int ledPin = 13;  // digital pin 13

  void setup()
  {
  pinMode(ledPin, OUTPUT);  // sets pin 13 as output
  }

  void loop()
  {
  // V
  digitalWrite(ledPin, HIGH); // dot
  delay(200);
  digitalWrite(ledPin, LOW);
  delay(100);

  digitalWrite(ledPin, HIGH); // dot
  delay(200);
  digitalWrite(ledPin, LOW);
  delay(100);

  digitalWrite(ledPin, HIGH); // dot
  delay(200);
  digitalWrite(ledPin, LOW);
  delay(100);

  digitalWrite(ledPin, HIGH); // dash
  delay(600);
  digitalWrite(ledPin, LOW);
  delay(800);

  // ...

  // you get the picture!

  delay(3000);  // wait 3sec before repeat

  }


Leave a Comment

Basic HTML tags and Markdown syntax are allowed.