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(4, INPUT);
- pinMode(3, INPUT);
- Serial.begin(38400);
- //attachInterrupt(digitalPinToInterrupt(2), blink, CHANGE);
- //attachInterrupt(digitalPinToInterrupt(3), blink, CHANGE);
- }
- void loop() {
- // put your main code here, to run repeatedly:
- int ia = i;
- if(A==B){
- if(A!=digitalRead(4)){
- i++;
- A = digitalRead(4);
- }
- if(B!=digitalRead(3)){
- i--;
- B = digitalRead(3);
- }
- }
- else{
- if(A!=digitalRead(4)){
- i--;
- A = digitalRead(4);
- }
- if(B!=digitalRead(3)){
- i++;
- B = digitalRead(3);
- }
- }
- if(i != ia){
- Serial.print("\n\n\n\n\n\n\n\n\n\n pulsos:");
- Serial.println(i);
- }
- }
Add Comment
Please, Sign In to add comment