encoder

Dependencies:   mbed

Revision:
1:36b9ba5a34ff
Parent:
0:4d7336a951bd
--- a/encoder.cpp	Wed Oct 27 05:18:30 2021 +0000
+++ b/encoder.cpp	Sun Oct 31 09:43:58 2021 +0000
@@ -2,7 +2,6 @@
 #include "QEI.h"
 
 QEI encoder (A0,A1,NC,2500);
-DigitalOut dout(LED1);
 Serial pc(USBTX, USBRX);
 int counter = 0;
 int cur_state = 0;
@@ -13,6 +12,9 @@
         if( counter > cur_state){
             cur_state = counter;
             printf("%d ", cur_state);
-            }
+            }else if(counter < cur_state){
+                cur_state = counter;
+                printf("%d ", cur_state);
+                }                
         }
 }
\ No newline at end of file