my qei test

Dependencies:   mbed QEI

Committer:
piroro4560
Date:
Mon Oct 25 11:40:10 2021 +0000
Revision:
3:2fa96acedf7b
Parent:
2:07d72c351053
make

Who changed what in which revision?

UserRevisionLine numberNew contents of line
highfieldsnj 0:fb962a369fdf 1 #include "QEI.h"
highfieldsnj 0:fb962a369fdf 2
highfieldsnj 1:5c265e848abb 3 Serial pc(PA_2, NC, 115200);
highfieldsnj 0:fb962a369fdf 4 //DigitalIn b(USER_BUTTON);
highfieldsnj 0:fb962a369fdf 5 //Use X4 encoding.
highfieldsnj 0:fb962a369fdf 6 QEI wheel[] = {
piroro4560 3:2fa96acedf7b 7 QEI(PA_1,PA_0,NC,100,QEI::X4_ENCODING),
highfieldsnj 2:07d72c351053 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),
piroro4560 3:2fa96acedf7b 10 QEI(PB_7,PB_6,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 }