User Tools

Site Tools


arduino:sketch

This is an old revision of the document!


La structure d'un programme ARDUINO

Structure

Un programme sur Arduino est au moins constituée de 2 parties obligatoires :

  • Une fonction void setup (void) appeléee 1 fois à l'initialisation du système (reset) 1).
/*
  Blink
  Turns an LED on for one second, then off for one second, repeatedly.
*/
void setup() {
  // initialize digital pin LED_BUILTIN  as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}
  • Une fonction void loop (void) appelée qui est appellé régulièrement aprèes l'initialisation par la fonction setup.
// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);  
    // turn the LED on (HIGH is the voltage level)
  delay(1000);                       
    // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    
    // turn the LED off by making the voltage LOW
  delay(1000);                       
    // wait for a second
}
1)
Soit lorsque le transfert du programme est terminée, soit lorsque l'utilisateur appuie sur le bouton reset
arduino/sketch.1618153792.txt.gz · Last modified: 2021/04/11 15:09 by bmonsuez