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

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

Augustin Aziankou updated their profile
6 hours ago
Corey Adams updated their profile
12 hours ago
Profile IconAugustin Aziankou, Hugo Oliveira, tim walling and 1 more joined GarageLab (arduino, electronics, robotics, hacking)
13 hours ago
Marcelo Rodrigues replied to Peter Davies's discussion Anyone got stock of Garagelabs automation board
"Peter, AB is back on Seeed. They still some units to…"
13 hours ago
Profile IconMarc Stevens, Rafael Caballos, Sobhan kumar vellanki and 1 more joined GarageLab (arduino, electronics, robotics, hacking)
Friday
Profile IconEmma Junge and Halil Birtan joined GarageLab (arduino, electronics, robotics, hacking)
Wednesday
m fluer is now a member of GarageLab (arduino, electronics, robotics, hacking)
May 21
Craig P. Summers commented on GarageLab's blog post A Robot Controlling a Switch
"True automation is becoming more frequent in todays life as automated home helps home homeowners in…"
May 21
Profile Icongeorge villaflor, Steve Kotlowski, John McClure and 1 more joined GarageLab (arduino, electronics, robotics, hacking)
May 20
Anthony M. Hagy commented on GarageLab's blog post Project Sunroof
"Great project idea. The roof is an important part of home, roof contractor plays an important role…"
May 20
Anthony M. Hagy commented on GarageLab's blog post Apple Aims to Test Self-Driving Cars at Military Base
"Nice Post. Thank you for sharing."
May 20
Profile Iconabdelrahman taher, Marcus Ataide, Anthony M. Hagy and 4 more joined GarageLab (arduino, electronics, robotics, hacking)
May 16
Profile IconKeshava DEv, bryan mcfadden and babbelkwebbel joined GarageLab (arduino, electronics, robotics, hacking)
May 9
Rosa Yu is now a member of GarageLab (arduino, electronics, robotics, hacking)
May 6
Profile IconMarvin Wright and chaudhari vipin vasudev joined GarageLab (arduino, electronics, robotics, hacking)
May 4
Marcelo Rodrigues replied to Peter Davies's discussion Anyone got stock of Garagelabs automation board
"Peter, I will talk them to check if they can produce more units and make available on their…"
May 3
Brian B. Feaster commented on GarageLab's blog post Information Trade Between Cars by Wi-Fi
"I like this idea of information trade between cars by the WI-Fi . This would contribute in reducing…"
May 2
Peter Davies replied to Peter Davies's discussion Anyone got stock of Garagelabs automation board
"Hi Marcello I have bought all of Seeeds stock in two purchases - 8 units in all.  When I asked…"
May 2
Profile Icontarun patel, Enrique S. Perez Rodriguez, K Fiore and 5 more joined GarageLab (arduino, electronics, robotics, hacking)
May 2
Marcelo Rodrigues replied to Peter Davies's discussion Anyone got stock of Garagelabs automation board
"Peter, You can buy them on…"
May 2

© 2016   Created by Marcelo Rodrigues.   Powered by

Badges  |  Report an Issue  |  Terms of Service