Skip to content

Instantly share code, notes, and snippets.

@zippy1981
Created April 22, 2012 20:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zippy1981/2466705 to your computer and use it in GitHub Desktop.
Save zippy1981/2466705 to your computer and use it in GitHub Desktop.
Arduino SOS Program
/*
SOS
Sends SOS in morse code on the Arduino board.
For more information see http://en.wikipedia.org/wiki/Morse_code
Copyright 2012 Justin Dearing.
*/
int dotDur = 125;
int dashDur = dotDur * 3;
int wordPause = dotDur * 7;
void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(13, OUTPUT);
}
void loop() {
dot(dotDur);
dot(dotDur);
dot(dashDur);
dash(dotDur);
dash(dotDur);
dash(dashDur);
dot(dotDur);
dot(dotDur);
dot(wordPause);
}
void dash(int pauseDur) {
digitalWrite(13, HIGH); // set the LED on
delay(dashDur);
digitalWrite(13, LOW); // set the LED off
delay(pauseDur);
}
void dot(int pauseDur) {
digitalWrite(13, HIGH); // set the LED on
delay(dotDur); // wait for a second
digitalWrite(13, LOW); // set the LED off
delay(pauseDur);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment