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

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
10 hours ago
Colin Goldberg posted a discussion

Can I use my Samsung Tab 4 tablet as a usb host to a beaglebone board black?

Hi,As a newbie to this space, I would like to know what to think about before I try to connect my…See More
Tuesday
Antonio Turner posted a status
Tuesday
GarageLab posted blog posts
Tuesday
Profile IconGeorge Ray Learmond, Steve Barnes and Diego Leite Mendes joined GarageLab (arduino, electronics, robotics, hacking)
Monday
GarageLab posted a blog post
Oct 17
Stu porley is now a member of GarageLab (arduino, electronics, robotics, hacking)
Oct 16
GarageLab posted blog posts
Oct 16
Atari Punk Console posted a status
"I backed Garag Lab Kick Starter Project the Garagino, I can't wait till I get my Garagino! https://www.kickstarter.com/projects/931487098/g"
Oct 15
Profile IconDan bgarage and Joe Cannella joined GarageLab (arduino, electronics, robotics, hacking)
Oct 15
GarageLab posted blog posts
Oct 14
Profile IconSim Wilkins G. Entendez, Charles Hamilton and Colin Goldberg joined GarageLab (arduino, electronics, robotics, hacking)
Oct 13
GarageLab posted a blog post

Flexible 'Tentacle Robots' Could Aid Planetary Exploration

 Researchers are developing new types of robotic systems inspired by elephant trunks, octopus arms…See More
Oct 10
David Rios is now a member of GarageLab (arduino, electronics, robotics, hacking)
Oct 10
GarageLab posted blog posts
Oct 9
Marcelo Rodrigues is now friends with Tharaka Madhusanka and Guruprasad Balaji
Oct 7
GarageLab posted a blog post
Oct 7
GarageLab posted a blog post
Oct 6
Profile IconScorpio Imran, Joaquim Moroni da Silva, Delan and 1 more joined GarageLab (arduino, electronics, robotics, hacking)
Oct 6
GarageLab posted blog posts
Oct 3

© 2014   Created by Marcelo Rodrigues.

Badges  |  Report an Issue  |  Terms of Service