Hacer que el LED emita el código Morse de SOS: tres destellos cortos, tres largos y tres cortos, con una pausa larga entre repeticiones del ciclo.
const int pinLed = 13; void setup() { pinMode(pinLed, OUTPUT); } void loop() { // ··· S — tres destellos cortos digitalWrite(pinLed, HIGH); delay(200); digitalWrite(pinLed, LOW); delay(200); digitalWrite(pinLed, HIGH); delay(200); digitalWrite(pinLed, LOW); delay(200); digitalWrite(pinLed, HIGH); delay(200); digitalWrite(pinLed, LOW); delay(400); // pausa entre letras // — — — O — tres destellos largos digitalWrite(pinLed, HIGH); delay(600); digitalWrite(pinLed, LOW); delay(200); digitalWrite(pinLed, HIGH); delay(600); digitalWrite(pinLed, LOW); delay(200); digitalWrite(pinLed, HIGH); delay(600); digitalWrite(pinLed, LOW); delay(400); // pausa entre letras // ··· S — tres destellos cortos digitalWrite(pinLed, HIGH); delay(200); digitalWrite(pinLed, LOW); delay(200); digitalWrite(pinLed, HIGH); delay(200); digitalWrite(pinLed, LOW); delay(200); digitalWrite(pinLed, HIGH); delay(200); digitalWrite(pinLed, LOW); delay(1500); // pausa antes del siguiente SOS }