Advertisement
mnlpnn

anti rimbalzo

Feb 25th, 2020
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #define led 13
  2. #define pulsante 4
  3. int statopresentepulsante = LOW;
  4. int statoprecedentepulsante = LOW;
  5. int numero;
  6.  
  7. void setup()
  8. {
  9. pinMode(led, OUTPUT);
  10. pinMode(pulsante, INPUT);
  11. randomSeed(analogRead(0));
  12. Serial.begin(9600);
  13. }
  14.  
  15. void loop()
  16. {
  17. statopresentepulsante = digitalRead (pulsante);
  18. if((statopresentepulsante == HIGH)&&(statoprecedentepulsante == LOW))
  19. {
  20. numero=random(1,7);
  21. Serial.print(numero);
  22. Serial.print(" ");
  23.  
  24. }
  25. statoprecedentepulsante = statopresentepulsante;
  26. delay (50);
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement