Guest User

Untitled

a guest
May 17th, 2018
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. volatile int contador = 0;
  2. int n = contador;
  3.  
  4. long t = 0;
  5. void setup() {
  6.  
  7. pinMode(2, INPUT_PULLUP);
  8. attachInterrupt( 0, incrementaContador, FALLING);
  9. }
  10.  
  11. void loop() {
  12. if (n != contador) {
  13. n = contador;
  14. }
  15. }
  16.  
  17. void incrementaContador() {
  18.  
  19. if ( millis() > (t + 50) ) {
  20. contador++ ;
  21. t = millis();
  22. }
  23. }
Add Comment
Please, Sign In to add comment