Advertisement
Bukisoh

HAMZA CLIQUE ICI

Jan 7th, 2020
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. int etatBP=0;
  2. bool etat=false;
  3. int chrono=0;
  4. int temps=0;
  5.  
  6.  
  7. void setup()
  8. {
  9.   pinMode(2, INPUT);
  10.   pinMode(13, OUTPUT);
  11.   pinMode(9, OUTPUT);
  12.   Serial.begin(9600);
  13.   attachInterrupt(digitalPinToInterrupt(2),temp,RISING);
  14. }
  15.  
  16. void loop()
  17. {
  18.  
  19.  
  20.   etatBP = digitalRead(2);
  21.  
  22.   if (etatBP) {
  23.     digitalWrite(13, HIGH);
  24.     digitalWrite(9, HIGH);
  25.  
  26.   } else {
  27.     digitalWrite(13, LOW);
  28.     digitalWrite(9, LOW);
  29.  
  30.   }
  31.   delay(10);
  32.      }
  33.  
  34. void temp(){
  35.   chrono=millis();
  36.   chrono = (chrono - temps);
  37.   temps=millis();
  38.   Serial.println(chrono);
  39.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement