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 switch off and on a LED light with an 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)
digitalWrite(13, HIGH);
delay(600); // Wait for 600 millisecond(s)
digitalWrite(13, LOW);
delay(600); // Wait for 600 millisecond(s)//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 SOS and Rohiatou
delay(1400);//wait seven times to seperate words
//SdigitalWrite(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)
}
>/pre>