Advertisement
IrvinHeslan

Arduino_Bouton_Simple

Feb 17th, 2014
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1. //Irvin Heslan TS4
  2. //Simple Programme qui envoit un message lors de l'appui sur un bouton
  3.  
  4. const int Bouton = 2;
  5.  
  6. int Etat_Bouton = 0;  // Etat du Bouton
  7.  
  8. void setup() {
  9.   pinMode(Bouton, INPUT); // Bouton Definit comme entrée
  10.   Serial.begin(9600);  
  11. }
  12.  
  13. void loop(){
  14.   Etat_Bouton = digitalRead(Boutton);
  15.   if (Etat_Bouton == HIGH) {   //Boucle conditionnelle "si/alors" (si le bouton est pressé alors)    
  16.   Serial.Println("Bouton appuyé"); //afficher dans la console Bouton appuyé
  17.   }
  18.   else { //boucle conditionnelle "sinon"
  19.   Serial.Println("Bouton non appuyé");
  20.   }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement