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

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

Profile IconEdgard Komoda and Bill joined GarageLab (arduino, electronics, robotics, hacking)
7 hours ago
GarageLab posted blog posts
yesterday
Raghuvir G posted discussions
yesterday
Jagajeet K posted a discussion

Digital IO – LED Blink – Arduino for Beginners

I have a doubt in the below link  …in that I used 220 ohm resistor for LED …Is Resistor have any…See More
yesterday
Profile IconRalph Wade, Jagajeet K, Raghuvir G and 1 more joined GarageLab (arduino, electronics, robotics, hacking)
Wednesday
GarageLab posted blog posts
Tuesday
Enrico M. posted a status
"Building the Apollo console version I"
Monday
Lena Cook is now a member of GarageLab (arduino, electronics, robotics, hacking)
Monday
Paul Denton updated their profile
Nov 21
GarageLab posted a blog post
Nov 21
Profile IconRichard Coplan and Juan V. Sanchez-Andres joined GarageLab (arduino, electronics, robotics, hacking)
Nov 21
Kshitij Dadhekar commented on GarageLab's blog post Tutorial: How to use the Cellular Shield (SM5100B) with Arduino
"Hello,       Can you tell me what is the resistance of the speaker to be…"
Nov 19
GarageLab posted a blog post
Nov 19
Profile IconKshitij Dadhekar, Marvellous Mark and Enrico M. joined GarageLab (arduino, electronics, robotics, hacking)
Nov 19
david chan commented on GarageLab's blog post Tutorial: Humidity and Temperature Sensor with Arduino
"How do you see the output "
Nov 18
Enrico M. posted a discussion

Power supply circuit

Hi guys,I'm building some sort of wood case to arduino mega with LCD, keypad, LED's ...I also want…See More
Nov 18
GarageLab posted blog posts
Nov 18
Profile Icondavid chan, uday harihar, CVassiliou and 4 more joined GarageLab (arduino, electronics, robotics, hacking)
Nov 18
Jeff Bowen updated their profile
Nov 17
Michael Shaw replied to Jean-Guillaume LALANNE's discussion Smallest Arduino with BLE stack and push button integrated
"Check out Tiny circuits for open source: https://tiny-circuits.com/"
Nov 16

© 2014   Created by Marcelo Rodrigues.

Badges  |  Report an Issue  |  Terms of Service