This is a practical project using Arduino and a LED in order to give a message in Morse code.
Here's how Morse code works :
Here's how to create a code with Arduino to turn on and off a LED light with a SOS signal:
{
pinMode(13, OUTPUT);
}
void loop()
{
//S...
digitalWrite(13, HIGH);
delay(200); // Wait for 200 millisecond(s)
digitalWrite(13, LOW);
delay(200); // Wait for 200 millisecond(s)
digitalWrite(13, HIGH);
delay(200); // Wait for 200 millisecond(s)
digitalWrite(13, LOW);
delay(200); // Wait for 200 millisecond(s)
digitalWrite(13, HIGH);
delay(200); // Wait for 200 millisecond(s)
digitalWrite(13, LOW);
delay(200); // Wait for 200 millisecond(s)
//Space between letters 600ms
delay(600);
//O---
digitalWrite(13, HIGH);
delay(600); // Wait for 600 millisecond(s)
digitalWrite(13, LOW);
delay(600); // Wait for 600 millisecond(s)
digitalWrite(13, HIGH);
delay(600); // Wait for 600 millisecond(s)
digitalWrite(13, LOW);
delay(600); // Wait for 600 millisecond(s)
digitalWrite(13, HIGH);
delay(600); // Wait for 600 millisecond(s)
digitalWrite(13, LOW);
delay(600); // Wait for 600 millisecond(s)
//Space between letters 600ms
delay(600);
//S...
digitalWrite(13, HIGH);
delay(200); // Wait for 200 millisecond(s)
digitalWrite(13, LOW);
delay(200); // Wait for 200 millisecond(s)
digitalWrite(13, HIGH);
delay(200); // Wait for 200 millisecond(s)
digitalWrite(13, LOW);
delay(200); // Wait for 200 millisecond(s)
digitalWrite(13, HIGH);
delay(200); // Wait for 200 millisecond(s)
digitalWrite(13, LOW);
delay(200); // Wait for 200 millisecond(s)
//Space between word 1400ms
delay(1400);
//M--
digitalWrite(13, HIGH);
delay(600); // Wait for 600 millisecond(s)
digitalWrite(13, LOW);
delay(600); // Wait for 600 millisecond(s)
digitalWrite(13, HIGH);
delay(600); // Wait for 600 millisecond(s)
digitalWrite(13, LOW);
delay(600); // Wait for 600 millisecond(s)
digitalWrite(13, HIGH);
delay(600); // Wait for 600 millisecond(s)
digitalWrite(13, LOW);
delay(600); // Wait for 600 millisecond(s)
//Space between word 600ms
delay(600);
//I...
digitalWrite(13, HIGH);
delay(200); // Wait for 600 millisecond(s)
digitalWrite(13, LOW);
delay(200); // Wait for 600 millisecond(s)
digitalWrite(13, HIGH);
delay(200); // Wait for 600 millisecond(s)
digitalWrite(13, LOW);
delay(200); // Wait for 600 millisecond(s)
digitalWrite(13, HIGH);
delay(200); // Wait for 600 millisecond(s)
digitalWrite(13, LOW);
delay(200); // Wait for 600 millisecond(s)
//Space between word 600ms
delay(200);
//R.-.
digitalWrite(13, HIGH);
delay(200); // Wait for 200 millisecond(s)
digitalWrite(13, LOW);
delay(200); // Wait for 200 millisecond(s)
digitalWrite(13, HIGH);
delay(200); // Wait for 200 millisecond(s)
digitalWrite(13, LOW);
delay(200); // Wait for 200 millisecond(s)
digitalWrite(13, HIGH);
delay(200); // Wait for 200 millisecond(s)
digitalWrite(13, LOW);
delay(200); // Wait for 200 millisecond(s)
//Space between word 600ms
delay(600);
//E.
digitalWrite(13, HIGH);
delay(200); // Wait for 200 millisecond(s)
digitalWrite(13, LOW);
delay(200); // Wait for 200 millisecond(s)
digitalWrite(13, HIGH);
//space between letters 600ms
//I...
digitalWrite(13, HIGH);
delay(200); // Wait for 600 millisecond(s)
digitalWrite(13, LOW);
delay(200); // Wait for 600 millisecond(s)
digitalWrite(13, HIGH);
delay(200); // Wait for 600 millisecond(s)
digitalWrite(13, LOW);
delay(200); // Wait for 600 millisecond(s)
digitalWrite(13, HIGH);
delay(200); // Wait for 600 millisecond(s)
digitalWrite(13, LOW);
delay(200); // Wait for 600 millisecond(s)
//Space between word 600ms
delay(200);
//A.-
digitalWrite(13, HIGH);
delay(200); // Wait for 600 millisecond(s)
digitalWrite(13, LOW);
delay(200); // Wait for 600 millisecond(s)
digitalWrite(13, HIGH);
delay(200); // Wait for 600 millisecond(s)
digitalWrite(13, LOW);
delay(200); // Wait for 600 millisecond(s)
digitalWrite(13, HIGH);
delay(200); // Wait for 600 millisecond(s)
digitalWrite(13, LOW);
delay(200); // Wait for 600 millisecond(s)
//Space between word 600ms
delay(200);
}