ding

Dependencies:   Encoder HIDScope mbed

main.cpp

Committer:
wiesdat
Date:
2014-10-27
Revision:
0:7e81becf02c6
Child:
1:1709bd849df0

File content as of revision 0:7e81becf02c6:

#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();
    }
}