Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- volatile int contador = 0;
- int n = contador;
- long t = 0;
- void setup() {
- pinMode(2, INPUT_PULLUP);
- attachInterrupt( 0, incrementaContador, FALLING);
- }
- void loop() {
- if (n != contador) {
- n = contador;
- }
- }
- void incrementaContador() {
- if ( millis() > (t + 50) ) {
- contador++ ;
- t = millis();
- }
- }
Add Comment
Please, Sign In to add comment