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

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
4 hours ago
GarageLab posted a blog post

What Could You Do With 7 Fingers?

A strange thought yes, but MIT researchers think an extra two digits could really make a difference…See More
yesterday
Profile Icongan bensie, Philip Malmstedt and Rodney Leinberger joined GarageLab (arduino, electronics, robotics, hacking)
yesterday
GarageLab posted blog posts
Monday
Profile Iconjolian ahmed, Abdalla, Raul Patterson and 2 more joined GarageLab (arduino, electronics, robotics, hacking)
Monday
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
NELU NASTASOIU updated their profile
Jul 11
GarageLab posted blog posts
Jul 11
Profile IconTezel Celebi and Lucas Silva joined GarageLab (arduino, electronics, robotics, hacking)
Jul 11
GarageLab posted a blog post

Lego robot plays freemium iPad games while creator sleeps

In 2011, Uli Kilian earned a Guinness World Record for solving 100 Rubik’s cubes during that year’s…See More
Jul 10
Profile IconYanik Chauvin and NELU NASTASOIU joined GarageLab (arduino, electronics, robotics, hacking)
Jul 8
Alexandre Araripe Cavalcante and Tharaka Madhusanka are now friends
Jul 8
Tharaka Madhusanka joined Jordan Weller's group
Thumbnail

Technology Concepts & Ideas

New devices and methods of constructing things, Old and recent inventions. Scientific theory.…See More
Jul 7
GarageLab posted blog posts
Jul 7
Profile Iconabdullah savas and Everth Gutierrez joined GarageLab (arduino, electronics, robotics, hacking)
Jul 7
Tharaka Madhusanka is now a member of GarageLab (arduino, electronics, robotics, hacking)
Jul 3

© 2014   Created by Marcelo Rodrigues.

Badges  |  Report an Issue  |  Terms of Service