Met kinematics
Dependencies: MODSERIAL QEI mbed-dsp mbed
Fork of Motorcode by
main.cpp
- Committer:
- SimonRez
- Date:
- 2018-09-24
- Revision:
- 6:1ee8795b7578
- Parent:
- 5:f07bafaf11d7
- Child:
- 7:e21056555296
File content as of revision 6:1ee8795b7578:
#include "mbed.h" #include "MODSERIAL.h" #include "QEI.h" Ticker Blinker; 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); } }