Skip to content

Instantly share code, notes, and snippets.

@sachendra003
Last active July 4, 2019 08:46
Show Gist options
  • Save sachendra003/d601019d539ed9cbc629f72ff3c4cf14 to your computer and use it in GitHub Desktop.
Save sachendra003/d601019d539ed9cbc629f72ff3c4cf14 to your computer and use it in GitHub Desktop.
Arduino Morse Code. SOS only make LED Blinking
int ledPin=8;
void setup() {
// put your setup code here, to run once:
pinMode(ledPin,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
flash(200); flash(200); flash(200); // S
delay(300); // otherwise the flashes run together
flash(500); flash(500); flash(500); // O
flash(200); flash(200); flash(200); // S
delay(1000);
}
void flash(int duration)
{
digitalWrite(ledPin,HIGH);
delay(duration);
digitalWrite(ledPin,LOW);
delay(duration);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment