Advertisement
hidromotic

G04_VII

Apr 11th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. //G04_VII
  2. void ProcesaBotones(void)
  3. {
  4. static bool BOTON_INC_presionado_ant = 0, estadoBOTON_INC;
  5. estadoBOTON_INC = 0;
  6. static bool BOTON_DEC_presionado_ant = 0, estadoBOTON_DEC;
  7. estadoBOTON_DEC = 0;
  8.  
  9. if (BOTON_INC_PRESIONADO == BOTON_INC_presionado_ant) estadoBOTON_INC = 0;
  10. else
  11. {
  12. BOTON_INC_presionado_ant = BOTON_INC_PRESIONADO;
  13. estadoBOTON_INC = BOTON_INC_presionado_ant;
  14. }
  15.  
  16. if (BOTON_DEC_PRESIONADO == BOTON_DEC_presionado_ant) estadoBOTON_DEC = 0;
  17. else
  18. {
  19. BOTON_DEC_presionado_ant = BOTON_DEC_PRESIONADO;
  20. estadoBOTON_DEC = BOTON_DEC_presionado_ant;
  21. }
  22.  
  23. tpo_arranque_ms = (estadoBOTON_INC == 1) ? (tpo_arranque_ms + 1000) : (tpo_arranque_ms);
  24. tpo_arranque_ms = (estadoBOTON_DEC == 1) ? (tpo_arranque_ms - 1000) : (tpo_arranque_ms);
  25.  
  26. tpo_arranque_ms = (tpo_arranque_ms < 1000) ? (1000) : (tpo_arranque_ms);
  27. tpo_arranque_ms = (20000 < tpo_arranque_ms) ? (20000) : (tpo_arranque_ms);
  28.  
  29. Serial.println(tpo_arranque_ms);
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement