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

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

Paul Lawler left a comment for Paul Lawler
"Paul has sadly passed away - please cancel his membership - RJB (wife)"
4 hours ago
tom jensen joined Marcelo Rodrigues's group
Thumbnail

Arduino

Group for the Arduino communitySee More
6 hours ago
GarageLab posted blog posts
10 hours ago
GarageLab posted blog posts
yesterday
Abraham de Villiers is now a member of GarageLab (arduino, electronics, robotics, hacking)
yesterday
GarageLab posted a blog post

3D printed humanoid robot goes open source

If you’ve ever dreamed of manufacturing your own legion of mechanical minions, a group of robotics…See More
Monday
Marion Hale posted a status
"Status"
Monday
Marion Hale posted a status
"Status"
Saturday
Marion Hale posted a status
"Status"
Saturday
Profile IconMarion Hale and Pratap Kumar Panigrahi joined GarageLab (arduino, electronics, robotics, hacking)
Friday
GarageLab posted blog posts
Jul 24
GarageLab posted blog posts
Jul 23
Profile Icongan bensie, Philip Malmstedt and Rodney Leinberger joined GarageLab (arduino, electronics, robotics, hacking)
Jul 22
GarageLab posted blog posts
Jul 21
Profile Iconjolian ahmed, Abdalla, Raul Patterson and 2 more joined GarageLab (arduino, electronics, robotics, hacking)
Jul 21
GarageLab posted blog posts
Jul 17
GarageLab posted blog posts
Jul 15
Ilyass Renswoude joined Sergio Imperador's group
Thumbnail

Robotics

Let's share ideas about building robots.See More
Jul 14
Profile IconShein Wah, Liu Chin Ho and Suresh Babu joined GarageLab (arduino, electronics, robotics, hacking)
Jul 14
NELU NASTASOIU posted photos
Jul 11

© 2014   Created by Marcelo Rodrigues.

Badges  |  Report an Issue  |  Terms of Service