int dotDelay = 200;
int dashDelay = 500;
int spaceDelay = 300;
int ledPin = 2;
void setup() {
pinMode(ledPin, OUTPUT);
}
void loop() {
// Morse code for "SOS"
blinkDot(); blinkDot(); blinkDot();
delay(spaceDelay);
blinkDot(); blinkDot(); blinkDot();
delay(spaceDelay);
blinkDot(); blinkDot(); blinkDot();
delay(spaceDelay * 3); //wait before repeating
}
void blinkDot() {
digitalWrite(ledPin, HIGH);
delay(dotDelay);
digitalWrite(ledPin, LOW);
delay(dotDelay);
}
void blinkDash() {
digitalWrite(ledPin, HIGH);
delay(dashDelay);
digitalWrite(ledPin, LOW);
delay(dotDelay);
}