Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (reading != lastButtonState) {
  2. // reset the debouncing timer
  3. lastDebounceTime = millis();
  4. }
  5. ///Millis Γ© o contador atual do MCU
  6. if ((millis() - lastDebounceTime) > debounceDelay) {
  7. // whatever the reading is at, it's been there for longer
  8. // than the debounce delay, so take it as the actual current state:
  9.  
  10. // if the button state has changed:
  11. if (reading != buttonState) {
  12. buttonState = reading;
  13.  
  14. // only toggle the LED if the new button state is HIGH
  15. if (buttonState == HIGH) {
  16. ledState = !ledState;
  17. }
  18. }
  19. }
  20.  
  21.  
  22. ======================
  23. if (input (BOTAO_INCREMENTO)) //apertou o botΓ£o
  24. {
  25. delay_ms(100);
  26. if (input (BOTAO_INCREMENTO)) // 100ms depois ainda estava apertando
  27. {
  28. x++; //entΓ£o incrementa
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement