my qei test

Dependencies:   mbed QEI

Committer:
highfieldsnj
Date:
Mon Oct 18 11:29:16 2021 +0000
Revision:
0:fb962a369fdf
Child:
1:5c265e848abb
rorikon test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
highfieldsnj 0:fb962a369fdf 1 #include "QEI.h"
highfieldsnj 0:fb962a369fdf 2
highfieldsnj 0:fb962a369fdf 3 Serial pc(USBTX, USBRX,115200);
highfieldsnj 0:fb962a369fdf 4 //DigitalIn b(USER_BUTTON);
highfieldsnj 0:fb962a369fdf 5 //Use X4 encoding.
highfieldsnj 0:fb962a369fdf 6 QEI wheel[] = {
highfieldsnj 0:fb962a369fdf 7 QEI(PB_7,PB_6,NC,100,QEI::X4_ENCODING),
highfieldsnj 0:fb962a369fdf 8 //QEI(PA_6,PA_7,NC,100,QEI::X4_ENCODING), だめ
highfieldsnj 0:fb962a369fdf 9 QEI(PA_9,PA_8,NC,100,QEI::X4_ENCODING),
highfieldsnj 0:fb962a369fdf 10 QEI(PA_1,PA_0,NC,100,QEI::X4_ENCODING)
highfieldsnj 0:fb962a369fdf 11 };
highfieldsnj 0:fb962a369fdf 12
highfieldsnj 0:fb962a369fdf 13 int main() {
highfieldsnj 0:fb962a369fdf 14 //b.mode(PullUp);
highfieldsnj 0:fb962a369fdf 15 while(1){
highfieldsnj 0:fb962a369fdf 16 /*if(b.read() == 0){
highfieldsnj 0:fb962a369fdf 17 for(int i=0; i<1; i++){
highfieldsnj 0:fb962a369fdf 18 wheel[i].reset();
highfieldsnj 0:fb962a369fdf 19 }
highfieldsnj 0:fb962a369fdf 20 }*/
highfieldsnj 0:fb962a369fdf 21 for(int i=0; i<3; i++){
highfieldsnj 0:fb962a369fdf 22 pc.printf("%d=%d ", i, wheel[i].getPulses());
highfieldsnj 0:fb962a369fdf 23 }
highfieldsnj 0:fb962a369fdf 24 pc.printf("\r\n");
highfieldsnj 0:fb962a369fdf 25 }
highfieldsnj 0:fb962a369fdf 26 }