samedi 30 octobre 2010

Make a led blinking

This time this is a led that blink the word amour in morse
ce coup ci c'est une led qui clignote avec le mot amour en morse.
voici le code :

/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.

This example code is in the public domain.
*/
// declaration des variables
int court = 500;
int longue = 2000;
int pause = 1000;
// initialisation du matos dans le setup
void setup() {
// initialize the digital pin as an output.
// pin 4 correspond a la led de la CM
// Pin 4 has an LED connected on most Arduino boards:
// pinmode declare la pin 4 output
pinMode(4, OUTPUT);

}

void loop() {
// On ecrit la lettre A
// high correpond a on
digitalWrite(4, HIGH); // set the LED on
// en milli seconde
delay(court); // wait for a second
// je l'eteint pendant une seconde
digitalWrite(4, LOW); // set the LED off
delay(pause); // wait for a second
digitalWrite(4, HIGH); // set the LED on
// en milli seconde
delay(longue); // wait for a second
// je l'eteint pendant une seconde
digitalWrite(4, LOW); // set the LED off
delay(pause); // wait for a second

// On ecrit la lettre M :
digitalWrite(4, HIGH); // set the LED on
// en milli seconde
delay(longue); // wait for a second
// je l'eteint pendant une seconde
digitalWrite(4, LOW); // set the LED off
delay(pause); // wait for a second
digitalWrite(4, HIGH); // set the LED on
// en milli seconde
delay(longue); // wait for a second
// je l'eteint pendant une seconde
digitalWrite(4, LOW); // set the LED off
delay(pause); // wait for a second


// On ecrit la lettre O
digitalWrite(4, HIGH); // set the LED on
// en milli seconde
delay(longue); // wait for a second
// je l'eteint pendant une seconde
digitalWrite(4, LOW); // set the LED off
delay(pause); // wait for a second
digitalWrite(4, HIGH); // set the LED on
// en milli seconde
delay(longue); // wait for a second
// je l'eteint pendant une seconde
digitalWrite(4, LOW); // set the LED off
delay(pause); // wait for a second
digitalWrite(4, HIGH); // set the LED on
// en milli seconde
delay(longue); // wait for a second
// je l'eteint pendant une seconde
digitalWrite(4, LOW); // set the LED off
delay(pause); // wait for a second

// on ecrit la lettre U
digitalWrite(4, HIGH); // set the LED on
// en milli seconde
delay(court); // wait for a second
// je l'eteint pendant une seconde
digitalWrite(4, LOW); // set the LED off
delay(pause); // wait for a second
digitalWrite(4, HIGH); // set the LED on
// en milli seconde
delay(court); // wait for a second
// je l'eteint pendant une seconde
digitalWrite(4, LOW); // set the LED off
delay(pause); // wait for a second
digitalWrite(4, HIGH); // set the LED on
// en milli seconde
delay(longue); // wait for a second
// je l'eteint pendant une seconde
digitalWrite(4, LOW); // set the LED off
delay(pause); // wait for a second


// on ecrit la lettre R
digitalWrite(4, HIGH); // set the LED on
// en milli seconde
delay(court); // wait for a second
// je l'eteint pendant une seconde
digitalWrite(4, LOW); // set the LED off
delay(pause); // wait for a second
digitalWrite(4, HIGH); // set the LED on
// en milli seconde
delay(longue); // wait for a second
// je l'eteint pendant une seconde
digitalWrite(4, LOW); // set the LED off
delay(pause); // wait for a second
digitalWrite(4, HIGH); // set the LED on
// en milli seconde
delay(court); // wait for a second
// je l'eteint pendant une seconde
digitalWrite(4, LOW); // set the LED off
delay(pause); // wait for a second
}

Aucun commentaire:

Enregistrer un commentaire