This is a practical project using Arduino and a LED in order to give a messagenin 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:
void setup()
{
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)
//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)
delay(600); // Wait for 600 millisecond(s)
digitalWrite(13, HIGH);
delay(600); // Wait for 600 millisecond(s)
digitalWrite(13, LOW);
//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)
//spacc between sos and Angel
//A
digitalWrite(13, HIGH);
delay(200); // Wait for 200 millisecond(s)
digitalWrite(13, LOW);
delay(200); // Wait for 200 millisecond(s)
digitalWrite(13, HIGH);
delay(600); // Wait for 600 millisecond(s)
digitalWrite(13, LOW);
delay(600); // Wait for 600 millisecond(s)
//N
digitalWrite(13, HIGH);
delay(600); // Wait for 600 millisecond(s)
digitalWrite(13, LOW);
delay(600); // Wait for 600 millisecond(s)
digitalWrite(13, HIGH);
delay(200); // Wait for 200 millisecond(s)
digitalWrite(13, LOW);
delay(200); // Wait for 200 millisecond(s)
//G
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(200); // Wait for 200 millisecond(s)
digitalWrite(13, LOW);
delay(200); // Wait for 200 millisecond(s)
//E
digitalWrite(13, HIGH);
delay(200); // Wait for 200 millisecond(s)
digitalWrite(13, LOW);
delay(200); // Wait for 200 millisecond(s)
//L
digitalWrite(13, HIGH);
delay(200); // Wait for 200 millisecond(s)
digitalWrite(13, LOW);
delay(200); // Wait for 200 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(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)
}