pot controller voor positie, kp handmatig instellen, werkt met motor 1 en 2
Dependencies: MODSERIAL QEI mbed-dsp mbed
Fork of PI_controller_verbeteringen by
main.cpp
- Committer:
- SimonRez
- Date:
- 2018-09-25
- Revision:
- 7:e21056555296
- Parent:
- 6:1ee8795b7578
- Child:
- 8:9b517db94f49
File content as of revision 7:e21056555296:
#include "mbed.h" #include "MODSERIAL.h" #include "QEI.h" DigitalOut ledr(LED_RED); DigitalOut ledg(LED_GREEN); DigitalOut ledb(LED_BLUE); PwmOut pwmpin(PTA2); DigitalOut direct(PTB23); AnalogIn pot1(A0); QEI encoder(D12,D13,NC,32); InterruptIn sw2(SW2); InterruptIn sw3(SW3); MODSERIAL pc(USBTX, USBRX); int main() { ledr = 1; ledg = 1; ledb = 1; pc.printf("\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n ~~~A$$De$troyer69~~~ \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n"); pwmpin.period_us(60); pwmpin = 0; while (true) { pwmpin.write(pot1.read()); direct = 1; pc.printf("potmeter: %f, encoder: %i \r\n", pot1.read(), encoder.getPulses()); wait(0.2f); } }