![](/media/cache/group/9e3cc099b3b04bca937a1cca1da81b19.jpg.50x50_q85.jpg)
Poah als je je encoder in je motor wil aflezen en de beweging van je motor wilt aanpassen is dit programma echt voor jou!
Dependencies: mbed QEI HIDScope biquadFilter MODSERIAL FastPWM
Diff: main.cpp
- Revision:
- 1:68f74b2ceb7d
- Parent:
- 0:1843eec2b552
- Child:
- 2:6f5f300f0569
diff -r 1843eec2b552 -r 68f74b2ceb7d main.cpp --- a/main.cpp Fri Sep 20 12:38:05 2019 +0000 +++ b/main.cpp Fri Sep 20 13:56:03 2019 +0000 @@ -18,16 +18,20 @@ QEI encoder(D13,D12,NC,64,QEI::X4_ENCODING); int counts; -float degree; -float factor= 5.625; +float degreein; +float factorin= 5.625; +float degreeout; +float gearratio= 131.25; int main() { pc.baud(115200); pc.printf("\r\nStarting...\r\n\r\n"); while (true) { counts= encoder.getPulses(); - degree= counts*factor; - pc.printf("%f \r\n", degree); - wait(0.5); + degreein= counts*factorin; + degreeout= degreein/gearratio; + //pc.printf("%f \r\n", degreein); //draaigraden van inputgear en zo ook encoder. + pc.printf("%f \r\n", degreeout); + wait(0.5); } }