Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int A, B, i=0;
- void setup() {
- // put your setup code here, to run once:
- pinMode(2, INPUT);
- pinMode(3, INPUT);
- Serial.begin(38200);
- A = digitalWrite(2);
- B = digitalWrite(3);
- //attachInterrupt(digitalPinToInterrupt(2), blink, CHANGE);
- //attachInterrupt(digitalPinToInterrupt(3), blink, CHANGE);
- }
- void loop() {
- // put your main code here, to run repeatedly:
- if(A==B){
- if(A!=digitalRead(2)){
- i++;
- A = digitalRead(2);
- }
- if(B!=digitalRead(3)){
- i--;
- B = digitalRead(3);
- }
- }
- if(A!=B){
- if(A!=digitalRead(2)){
- i--;
- A = digitalRead(2);
- }
- if(B!=digitalRead(3)){
- i++;
- B = digitalRead(3);
- }
- }
- Serial.print("\n\n\n\n\n\n\n\n\n\n pulsos:");
- Serial.println(i);
- }
Add Comment
Please, Sign In to add comment