Alle subfiles samengevoegd
Dependencies: HIDScope biquadFilter mbed MODSERIAL FastPWM QEI
Diff: main.cpp
- Revision:
- 6:00011220b82b
- Parent:
- 5:b4a0301ec8cc
- Child:
- 7:bafc32b576c4
--- a/main.cpp Tue Oct 25 07:03:16 2016 +0000 +++ b/main.cpp Mon Oct 31 10:38:12 2016 +0000 @@ -1,19 +1,48 @@ #include "mbed.h" -#include "HIDScope.h" -#include "BiQuad.h" #include "math.h" #include "MODSERIAL.h" -#define SERIAL_BAUD 115200 +#include "HIDScope.h" +#include "FastPWM.h" +#include "QEI.h" +#include "BiQuad.h" +#define SERIAL_BAUD 115200 // baud rate for serial communication +// Serial connection MODSERIAL pc(USBTX,USBRX); + //EMG aansluitingen AnalogIn emg0( A0 ); //Biceps Rechts AnalogIn emg1( A1 ); //Bicpes Links AnalogIn emg2( A2 ); //Upper leg -//HIDScope -//HIDScope scope( 6 ); // aantal channels op de HIDscope -//Button om Calibratie te beëindigen -InterruptIn Button1(PTC6); // DIT WORDT EEN ANDERE BUTTON + +// Potmeter 1 gives the reference position x +AnalogIn pot1(A3); +// Potmeter 2 gives the reference position y +AnalogIn pot2(A4); + +// Setup Buttons +InterruptIn button1(PTB9); // button 1 +InterruptIn button2(PTA1); // button 2 +InterruptIn button3(PTC6); // SW2 +InterruptIn button4(PTA4); // SW3 + +// Set motor Pinouts +DigitalOut motor1_dir(D4); +FastPWM motor1_pwm(D5); +DigitalOut motor2_dir(D7); +FastPWM motor2_pwm(D6); + +// Set LED pins +DigitalOut led(LED_RED); + +// Set HID scope +HIDScope scope(6); + +// Set encoder +QEI m1_EncoderCW(D10,D11,NC,32); +QEI m1_EncoderCCW(D11,D10,NC,32); +QEI m2_EncoderCW(D13,D12,NC,32); +QEI m2_EncoderCCW(D12,D13,NC,32); // Tickers Ticker sample_timer; @@ -317,7 +346,7 @@ //potmeter dingen aanpassen pc.printf("calibreren is bezig\r\n"); - Button1.fall(&EndCalibration); + button1.fall(&EndCalibration); } /**Attach the 'sample' function to the timer 'sample_timer'.