The encoder DRS exercise
Dependencies: MODSERIAL QEI mbed
main.cpp
- Committer:
- Technical_Muffin
- Date:
- 2015-09-23
- Revision:
- 0:9aa5fb3f9174
File content as of revision 0:9aa5fb3f9174:
#include "mbed.h" #include "QEI.h" #include "MODSERIAL.h" DigitalOut gpo(D0); DigitalOut led(LED_RED); QEI motor1(D13,D12,NC, 624); MODSERIAL pc(USBTX,USBRX); int main() { pc.baud(115200); while(1) { wait(0.2); pc.printf("the amount of pulses is: %d\r\n",motor1.getPulses()); // the amount of counts for one revolution is 32 //this is X2 encodng, as the QEI usus X2 by default //and the motor encoder has a X4 encoder and thus 64 counts per revolution // X unit counts equals one magnet shaft rotation, with X being 64 //thus keeping in mind the gearbox the amount of counts for a gearbox revolution is 8400 } }