that_one_nigga_you_k

Untitled

Apr 22nd, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. int A, B, i=0;
  2.  
  3. void setup() {
  4. // put your setup code here, to run once:
  5. pinMode(2, INPUT);
  6. pinMode(3, INPUT);
  7. Serial.begin(38200);
  8. A = digitalWrite(2);
  9. B = digitalWrite(3);
  10. //attachInterrupt(digitalPinToInterrupt(2), blink, CHANGE);
  11. //attachInterrupt(digitalPinToInterrupt(3), blink, CHANGE);
  12. }
  13.  
  14. void loop() {
  15. // put your main code here, to run repeatedly:
  16.  
  17.  
  18.  
  19. if(A==B){
  20. if(A!=digitalRead(2)){
  21. i++;
  22. A = digitalRead(2);
  23. }
  24. if(B!=digitalRead(3)){
  25. i--;
  26. B = digitalRead(3);
  27. }
  28. }
  29.  
  30. if(A!=B){
  31. if(A!=digitalRead(2)){
  32. i--;
  33. A = digitalRead(2);
  34. }
  35. if(B!=digitalRead(3)){
  36. i++;
  37. B = digitalRead(3);
  38. }
  39. }
  40.  
  41.  
  42. Serial.print("\n\n\n\n\n\n\n\n\n\n pulsos:");
  43. Serial.println(i);
  44.  
  45. }
Add Comment
Please, Sign In to add comment