Advertisement
RuiViana

Testa Objeto

Feb 3rd, 2016
821
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #define sensor 3
  2. int flag = 0;
  3. //----------------------------------
  4. void funcao()
  5. {
  6. ;
  7. }
  8. //----------------------------------
  9. void setup() {
  10. Serial.begin(9600);
  11. }
  12. //------------------------------------------
  13. void loop() {
  14. if(digitalRead(sensor)==HIGH) // Se estão ALTO
  15. {
  16. flag = 1;
  17. }
  18.  
  19. if ((flag == 1) && (digitalRead(sensor)==LOW))
  20. {
  21. flag = 0;
  22. funcao(); // e vai pra baixo chama a função
  23. }
  24. else
  25. {
  26. ;
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement