ding
Dependencies: Encoder HIDScope mbed
Diff: main.cpp
- Revision:
- 0:7e81becf02c6
- Child:
- 1:1709bd849df0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Oct 27 10:02:16 2014 +0000 @@ -0,0 +1,36 @@ +#include "mbed.h" +#include "encoder.h" +#include "HIDScope.h" + +#define TSAMP 1 +#define K_P (0.1) +#define K_I (0.03 *TSAMP) +#define K_D (0.0005 /TSAMP) +#define I_LIMIT 1. + +#define M2_PWM PTC8 +#define M2_DIR PTC9 +#define M1_PWM PTA5 +#define M1_DIR PTA4 +DigitalIn encoderA(PTD0); +DigitalIn encoderB(PTA2); +PwmOut pwm(PTA5); +DigitalOut dir(PTA4); +HIDScope scope(5); +float encA, encB; + +int main(){ + while(1){ + pwm = 0.2; + dir = 1; + encA = encoderA.read(); + encB = encoderB.read(); + scope.set(0,pwm); + scope.set(1,encA); + scope.set(2,encB); + scope.send(); + } +} + + +