Opzetje
Dependencies: mbed QEI HIDScope biquadFilter MODSERIAL FastPWM
main.cpp
- Committer:
- boydmartherus
- Date:
- 2019-09-23
- Revision:
- 5:9f097dde857f
- Parent:
- 4:86872b89b21c
File content as of revision 5:9f097dde857f:
#include "mbed.h" #include "MODSERIAL.h" #include "FastPWM.h" #include "QEI.h" Serial pc(USBTX,USBRX); InterruptIn button1(PTC2); InterruptIn button2(PTC3); //motorcontrol AnalogIn pot(PTB2); FastPWM motor(D5); DigitalOut direction(D4); int p_rev = 4200; QEI encoder(D13,D12,NC,p_rev); int void() // set direction { direction.write(0); } int main() { printf("Control with dial\n"); wait(3.0); while(true) { wait(0.6); printf("motor speed is (%f)\n\r",pot.read()); wait(0.1); printf("aantal revoluties (%f)\n\r",encoder.getRevolutions()); printf("aantal pulses (%f)\n\r",encoder.getPulses()); wait(0.01); motor.write(pot); } }