Blink 4

Here is the entire code:

const byte ledPin = 12;
byte takes up less memory than the int

void setup() {
// sse ledPin as output
pinMode(ledPin, OUTPUT);
}

// create a function for short blink
void shortBlink() {
//we define ShortBlink
// make a single short blink
digitalWrite(ledPin, HIGH);
delay(200);
digitalWrite(ledPin, LOW);
delay(200);
}

// create a function for long blink
void longBlink() {
// make a single long blink
digitalWrite(ledPin, HIGH);
//LED is in ON mode
delay(600);
//LED duration in ON mode digitalWrite(ledPin, LOW);
//LED is in OFF mode
delay(200);
//LED duration in OFF mode }

void morseBlink(char character) {
//Char is a type, and character is a name.
// translate character to Morse code
switch(character){
//when there is a switch there must always be several cases and at the end of each case a break
case 's':
shortBlink();
//definition of case S
shortBlink();
//definition of case S
shortBlink();
//definition of case S
break;

case 'o':
longBlink();
//definition of case O
longBlink();
//definition of case O
longBlink();
//definition of case O
break;
}
}
void loop() {
// start blinking SOS
morseBlink('s');
//calls the previously defined function.
morseBlink('o');
//calls the previously defined function.
morseBlink('s');
}

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