Sunday, January 20, 2013

Morse Code Part One

Description: Flashes S.O.S. on repeat. You can find more about Morse code here. The image is especially helpful.

Video:

Pictures: 


Code: (Thanks to 30 Arduino Projects for the Evil Genius)
int ledPin = 10;


void setup()
{
  pinMode(ledPin,OUTPUT);
}
void loop()
{
  flash(200); flash(200); flash(200);
  delay(300);
  flash(500);flash(500);flash(500);
  delay(300);
  flash(200); flash(200); flash(200);
  delay(1000);
}

void flash(int duration)
{
  digitalWrite(ledPin , HIGH);
  delay(duration);
  digitalWrite(ledPin,LOW);
  delay(duration);
}

No comments:

Post a Comment