Ryu Anzawa
/
2021_Test_QEI_measuringWheelBoard
my qei test
main.cpp@1:5c265e848abb, 2021-10-18 (annotated)
- Committer:
- highfieldsnj
- Date:
- Mon Oct 18 11:31:02 2021 +0000
- Revision:
- 1:5c265e848abb
- Parent:
- 0:fb962a369fdf
- Child:
- 2:07d72c351053
for measuring wheel board
Who changed what in which revision?
User | Revision | Line number | New 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[] = { |
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 | } |