![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
werkt nog niet
Dependencies: HIDScope MODSERIAL biquadFilter mbed QEI
Fork of Project_script_union by
Diff: main.cpp
- Revision:
- 9:c722418997b5
- Parent:
- 8:895d941a5910
- Child:
- 10:39ec51206c8b
--- a/main.cpp Mon Oct 15 14:03:05 2018 +0000 +++ b/main.cpp Mon Oct 15 14:16:33 2018 +0000 @@ -1,23 +1,26 @@ #include "mbed.h" #include "MODSERIAL.h" -#include <math.h> -DigitalOut directionpin1(D4); -PwmOut pwmpin1(D5); -AnalogIn potmetervalue1(A1); -DigitalIn button2(D9); //klopt dit? -InterruptIn encoderA(D9); -InterruptIn encoderB(D8); +AnalogIn potmetervalue1 (A1); +AnalogIn potmetervalue2 (A2); +DigitalIn button2 (D10); //Let op, is deze niet bezet? +InterruptIn encoderA (D9); +InterruptIn encoderB (D8); -DigitalOut directionpin2(D7); -PwmOut pwmpin2(D6); -AnalogIn potmetervalue2(A2); +DigitalOut directionpin1 (D4); +DigitalOut directionpin2 (D7); +PwmOut pwmpin1 (D5); +PwmOut pwmpin2 (D6); + MODSERIAL pc(USBTX, USBRX); + +//Global variables int encoder = 0; - + +//Functions void encoderA_rise() { if(encoderB==false) @@ -67,6 +70,7 @@ } +// Main function start. int main() { @@ -93,9 +97,8 @@ wait(0.01f); //zodat de code niet oneindig doorgaat. pwmpin2 = fabs(m2*0.6f)+0.4f; directionpin2.write(m2>0); - - double angle_encoder = encoder*2*pi/8400 - pc.printf("Encoder count: %i\n\r",encoder); + + pc.printf("Encoder count: %i \n\r",encoder); //We moeten de encoder counts nog omzetten naar radialen of graden? } }