Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int etatBP=0;
- bool etat=false;
- int chrono=0;
- int temps=0;
- void setup()
- {
- pinMode(2, INPUT);
- pinMode(13, OUTPUT);
- pinMode(9, OUTPUT);
- Serial.begin(9600);
- attachInterrupt(digitalPinToInterrupt(2),temp,RISING);
- }
- void loop()
- {
- etatBP = digitalRead(2);
- if (etatBP) {
- digitalWrite(13, HIGH);
- digitalWrite(9, HIGH);
- } else {
- digitalWrite(13, LOW);
- digitalWrite(9, LOW);
- }
- delay(10);
- }
- void temp(){
- chrono=millis();
- chrono = (chrono - temps);
- temps=millis();
- Serial.println(chrono);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement