testing encoder without function

Dependencies:   mbed

encoder.cpp

Committer:
ea78anana
Date:
2021-11-01
Revision:
0:e180c98a3437

File content as of revision 0:e180c98a3437:

#include "mbed.h"
#include "QEI.h"

QEI encoder (A0,A1,NC,2500);
Serial pc(USBTX, USBRX);
int counter = 0;
int cur_state = 0;

int main(void) {  
        while(1){
        counter = counter++;
        if( counter > cur_state){
            cur_state = counter;
            printf("%d ", cur_state);
            }else if(counter < cur_state){
                cur_state = counter;
                printf("%d ", cur_state);
                }                
        }
}