SOS morse code blinker

martin.kiechle's picture

Here is my code which implements a SOS morse code blinker:

 

/*
   An SOS morse code blinker
 */
int i;
 
void setup() {                
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(13, OUTPUT);     
}
 
// SOS morse code blinker
void loop() {
  
  for(i=0; i<9; i++){
    if(i < 3 || i > 5){
      digitalWrite(13, HIGH);   // set the LED on
      delay(1000);              // wait for a second
      digitalWrite(13, LOW);    // set the LED off
    }
    if(i >= 3 && i < 6){
      digitalWrite(13, HIGH);   // set the LED on
      delay(200);              // wait for a second
      digitalWrite(13, LOW);
    }
    delay(500);
  }
}
blink circuit
0
Your rating: None