projets:coop:start

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
projets:coop:start [2021/01/14 17:08]
enseignant [Notes techniques et matériaux]
projets:coop:start [2021/01/14 17:14] (Version actuelle)
enseignant [Code simple pour arduino un bouton active un relai]
Ligne 24: Ligne 24:
  
 <code c+> <code c+>
-const int buttonPin = 2;     // the number of the pushbutton pin +const int buttonPin = 2;     // tapis switch 
-const int relai =  4;      // the number of the LED pin +const int relai =  4;      // relay pin 
- +int buttonState = 0;         // variable initialisant le tapis bouton
-// variables will change: +
-int buttonState = 0;         // variable for reading the pushbutton status+
  
 void setup() { void setup() {
-  // initialize the LED pin as an output: 
   pinMode(relai, OUTPUT);   pinMode(relai, OUTPUT);
-  // initialize the pushbutton pin as an input: 
   pinMode(buttonPin, INPUT);   pinMode(buttonPin, INPUT);
 } }
Ligne 41: Ligne 37:
   buttonState = digitalRead(buttonPin);   buttonState = digitalRead(buttonPin);
  
-  // check if the pushbutton is pressed. If it is, the buttonState is HIGH: 
   if (buttonState == HIGH) {   if (buttonState == HIGH) {
-    // turn LED on: 
     digitalWrite(relai, HIGH);     digitalWrite(relai, HIGH);
   } else {   } else {
-    // turn LED off: 
     digitalWrite(relai, LOW);     digitalWrite(relai, LOW);
   }   }
  • projets/coop/start.1610640515.txt.gz
  • Dernière modification: 2021/01/14 17:08
  • de enseignant