Blink 1


Here is the entire code:

int led_red = 12; // the red LED is connected to Pin 12 of the Arduino
void setup() {
// set up all the LEDs as OUTPUT
pinMode(led_red, OUTPUT);
}

void loop() {
// turn the red LED on and off (in this case SOS) inside the loop (bucle)
S();
// we tell it to play that S
O();
// we tell it to play that O
S();
// we tell it to play that S
_();
//we tell it to play a pause
}

void S() {
We define the letter S
digitalWrite(led_red, HIGH);
//LED is in ON mode
delay(300); // wait 0,3 seconds(LED duration in ON mode)
digitalWrite(led_red, LOW);
//LED is in OFF mode
delay(100); // wait 0,1 second(LED duration in OFF mode)
digitalWrite(led_red, HIGH);
delay(300); // wait 0,3 seconds
digitalWrite(led_red, LOW);
delay(100); // wait 0,1 second
digitalWrite(led_red, HIGH);
delay(300); // wait 0,3 seconds
digitalWrite(led_red, LOW);
delay(100); // wait 0,1 second
}
void O() {
// We define the letter O
digitalWrite(led_red, HIGH);
//LED is in ON mode
delay(900); // wait 0,9 seconds(LED duration in ON mode)
digitalWrite(led_red, LOW);
//LED is in OFF mode
delay(100); // wait 0,1 second(LED duration in OFF mode)
digitalWrite(led_red, HIGH);
delay(900); // wait 0,9 seconds
digitalWrite(led_red, LOW);
delay(100); // wait 0,1 second
digitalWrite(led_red, HIGH);
delay(900); // wait 0,9 seconds
digitalWrite(led_red, LOW);
delay(100); // wait 0,1 second
}
void _() {
digitalWrite(led_red, LOW);
We define the pause
delay(2000); // wait 2 second(LED duration in pause mode)
}

By: Juan Antonio Calvete and Joel PoderĂ³s.