![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
br g5
Dependencies: mbed QEI HIDScope biquadFilter MODSERIAL FastPWM
main.cpp
- Committer:
- boydmartherus
- Date:
- 2019-09-23
- Revision:
- 17:3751c2c685ca
- Parent:
- 16:0ff43ed4d259
- Child:
- 18:3de4412d8b63
File content as of revision 17:3751c2c685ca:
#include "mbed.h" #include "MODSERIAL.h" #include "FastPWM.h" #include "QEI.h" Serial pc(USBTX,USBRX); // functies aan PINs toevoegen FastPWM led(PTA1); FastPWM motor(D5); AnalogIn pot(PTB2); InterruptIn button(PTB3); // timer opzetten = ticker Ticker ticker; // opzetten van hoekbepaling int pulses = 4200; QEI wheel (D13,D12,NC,pulses); // aparte functies // functie hoekbepaling void hoek_bepaling() { wheel.getPulses(); } //functie motor aansturen met pot void motor_running() { motor.write(pot); led.write(pot); } // functie print output void main_loop() { hoek_bepaling(); motor_running(); } int main() { ticker.attach(&mainloop, 0.001f); while(true){}; }