This is practical project using Neocities 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:
void setup()
{
pinMode(13, OUTPUT);
}
void loop()
{ //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);
//M--
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);
//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 200 millisecond(s)
digitalWrite(13, LOW);
delay(600); // 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);
// Y-.--
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);
//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(200); // Wait for 600 millisecond(s)
digitalWrite(13, LOW);
delay(200); // 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 600 millisecond(s)
digitalWrite(13, LOW);
delay(200); // Wait for 600 millisecond(s)
//Space between letters 600ms
delay(600);
//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)
}