Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2020
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1.  
  2. const int bouton = 4;
  3. const int led = 2;
  4.  
  5.  
  6. int etatBouton = 0;
  7.  
  8.  
  9. void setup() {
  10.  
  11. pinMode(led, OUTPUT);
  12.  
  13. pinMode(bouton, INPUT);
  14. }
  15.  
  16.  
  17. void loop(){
  18.  
  19. etatBouton = digitalRead(bouton);
  20.  
  21.  
  22. if (etatBouton == LOW) {
  23.  
  24. digitalWrite(led, HIGH);
  25. }
  26. else {
  27.  
  28. digitalWrite(led, LOW);
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement