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: 1690

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 blog posts
13 hours ago
Profile IconSherwin Biares, Divya Bharti, Shankaar Nag and 2 more joined GarageLab (arduino, electronics, robotics, hacking)
21 hours ago
GarageLab posted blog posts
Thursday
Gaston Lieutier is now a member of GarageLab (arduino, electronics, robotics, hacking)
Jul 28
GarageLab posted blog posts
Jul 28
Volkan Coskun posted a discussion

Problem with my motordriver and dc motor

GarageLab enthusiasts!I am trying to build a balancing robot with two wheels, using the polulu gear…See More
Jul 27
Profile IconHugo Saffir and Volkan Coskun joined GarageLab (arduino, electronics, robotics, hacking)
Jul 27
GarageLab posted blog posts
Jul 24
Profile IconJoseph Long and Pablo Costas joined GarageLab (arduino, electronics, robotics, hacking)
Jul 23
GarageLab posted blog posts
Jul 22
Profile Iconvictor ghenno, Michel Souza Medeiros, ANAND S and 6 more joined GarageLab (arduino, electronics, robotics, hacking)
Jul 21
GarageLab posted blog posts
Jul 20
Chris replied to Chris's discussion Newbie question ......suitable power supply
"I just had a reply on another forum does this make sense? "The device you purchased is not…"
Jul 16
Profile IconPedro A Vazquez, Dylan, Feliks Gadzinski and 1 more joined GarageLab (arduino, electronics, robotics, hacking)
Jul 16
Chris posted a discussion

Newbie question ......suitable power supply

Hi guysFirstly I have no knowledge whatsoever of Electronics and RF, my background back in the UK…See More
Jul 16
GarageLab posted a blog post

Micro:Bit — BBC gets a million kids into embedded dev

In the Early 1980s, the BBC launched a project to teach computer literacy to a generation of…See More
Jul 16
Profile IconDavid Bissonnette, Bob Blanco, Mark Pind and 4 more joined GarageLab (arduino, electronics, robotics, hacking)
Jul 15
GarageLab posted blog posts
Jul 15
Phan Minh Kha commented on Thulana Vimukthi's blog post GPS GUIDED AUTONOMOUS ROBOT
"bool condition = ((angleDegrees -10) < headingDegrees) && ((angleDegrees +10) >…"
Jul 14
Phan Minh Kha commented on Thulana Vimukthi's blog post GPS GUIDED AUTONOMOUS ROBOT
"dist_calc=sqrt((((flon1)-(x2lon))*((flon1)-(x2lon)))+(((x2lat-flat1)*(x2lat-flat1))));…"
Jul 14

© 2015   Created by Marcelo Rodrigues.

Badges  |  Report an Issue  |  Terms of Service