This project turns your arduino into a sos morse code sender. It sends the code using a LED connected to the digital pin 10. 

To build this project you will need:

  • 1 Arduino board
  • 1 LED
  • 1 220ohm resistor

Build the circuit like the picture above.

Then, upload the following code:

// LED connected to digital pin 10 
int ledPin = 10;

// run once, when the sketch starts
void setup() 
{
// sets the digital pin as output
pinMode(ledPin, OUTPUT); 
}

// run over and over again 
void loop() 
{
// 3 dits
for (int x=0; x<3; x++) {
digitalWrite(ledPin, HIGH); // sets the LED on
delay(150); // waits for 150ms
digitalWrite(ledPin, LOW); // sets the LED off
delay(100); // waits for 100ms
}

// 100ms delay to cause slight gap between letters
delay(100); 
// 3 dahs
for (int x=0; x<3; x++) {
digitalWrite(ledPin, HIGH); // sets the LED on
delay(400); // waits for 400ms
digitalWrite(ledPin, LOW); // sets the LED off
delay(100); // waits for 100ms
}

// 100ms delay to cause slight gap between letters 
delay(100); 

// 3 dits again
for (int x=0; x<3; x++) {
digitalWrite(ledPin, HIGH); // sets the LED on
delay(150); // waits for 150ms
digitalWrite(ledPin, LOW); // sets the LED off
delay(100); // waits for 100ms
}

// wait 5 seconds before repeating the SOS signal 
delay(5000); 
}

When finished, the arduino will start blinking the LED with the SOS morse signal.

That's it!

References:

http://arduino.cc/en/

http://www.labdegaragem.org/loja/index.php/47-livros/arduino-basico...

Views: 1219

Tags: arduino, project

Comment by Ed Goulart on February 2, 2013 at 2:23pm

Indeed a nice code!

A good challenge would be not to repeat the second "di-di-dit", redirecting the program to the first routine.

Comment by Robin Hemmer on August 9, 2013 at 9:10am

this worked for me - 

// Another SOS sketch by Robin Hemmer

// LED connected to digital pin 10
int ledPin = 13;

// run once, when the sketch starts
void setup()
{
// sets the digital pin as output
pinMode(ledPin, OUTPUT);
}

// run over and over again
void loop()
{
// 3 dits
for (int x=0; x<3; x++)
{
dit();
}

// 300ms delay to cause slight gap between letters
delay(300);
// 3 dahs
for (int x=0; x<3; x++)
{
dah();
}

// 300ms delay to cause slight gap between letters
delay(300);

// 3 dits again
for (int x=0; x<3; x++)
{
dit();
}
// wait 3 seconds before repeating the SOS signal
delay(3000);
}

void dit()
{

digitalWrite(ledPin, HIGH); // sets the LED on
delay(150); // waits for 150ms
digitalWrite(ledPin, LOW); // sets the LED off
delay(100); // waits for 100ms

}

void dah()
{
digitalWrite(ledPin, HIGH); // sets the LED on
delay(400); // waits for 400ms
digitalWrite(ledPin, LOW); // sets the LED off
delay(100); // waits for 100ms
}

Comment

You need to be a member of GarageLab (arduino, electronics, robotics, hacking) to add comments!

Join GarageLab (arduino, electronics, robotics, hacking)

Latest Activity

GarageLab posted a blog post
6 hours ago
Profile Iconleon crist, Tim Owen and Mishca de Costa joined GarageLab (arduino, electronics, robotics, hacking)
yesterday
GarageLab posted a blog post

Arduino-Powered Turntables That Turn DJing Into Child’s Play

Per Holmquist has always had a finely tuned ear for music. “When I hear a song for the first time I…See More
yesterday
GarageLab posted a blog post
Friday
Jean-Guillaume LALANNE posted a discussion

Smallest Arduino with BLE stack and push button integrated

Hi,I am a newbie in the maker world. I have bought a RFDUINO some month ago to play with.I did find…See More
Friday
Profile IconDavid bolles and Abhisht Yadav joined GarageLab (arduino, electronics, robotics, hacking)
Thursday
GarageLab posted blog posts
Thursday
chuby okafor updated their profile
Thursday
maurice patrick commented on GarageLab's blog post 3D printer uses Arduino controller and makes food in unusual ways
"Sweet!!!!"
Wednesday
Stephen Wizowski left a comment for Stephen Wizowski
"NO... do not like this approach... AT ALL!"
Wednesday
Profile IconBernie Whalen, FRANK KWABENA, mikedaniels and 11 more joined GarageLab (arduino, electronics, robotics, hacking)
Sep 10
GarageLab posted a blog post

This Robot Crawls Through Acid, Ice and Fire

This robot, developed at Professor George M. Whitesides’ lab at Harvard University has recently…See More
Sep 10
GarageLab posted a blog post
Sep 8
Antonio Turner posted a status
Sep 8
GarageLab posted blog posts
Sep 5
Profile IconWilliam Ritchie, Chuck Untulis, David Perez and 3 more joined GarageLab (arduino, electronics, robotics, hacking)
Sep 5
GarageLab posted blog posts
Sep 3
GarageLab posted blog posts
Sep 2
Joonas Karjalainen is now a member of GarageLab (arduino, electronics, robotics, hacking)
Sep 2
Veritus posted photos
Sep 1

© 2014   Created by Marcelo Rodrigues.

Badges  |  Report an Issue  |  Terms of Service