PID en biquad filter implemented and outcommented
Dependencies: Motor_with_encoder MODSERIAL mbed QEI
Fork of Tutorial_lecture5_pin_pot_motor by
Diff: main.cpp
- Revision:
- 2:80177e90c1e6
- Parent:
- 1:e0f6cdefcd6e
- Child:
- 3:4520d0ca4e56
diff -r e0f6cdefcd6e -r 80177e90c1e6 main.cpp --- a/main.cpp Tue Oct 03 15:24:46 2017 +0000 +++ b/main.cpp Fri Oct 06 08:26:55 2017 +0000 @@ -9,8 +9,8 @@ DigitalOut led1(D8); DigitalOut led2(D11); AnalogIn pot(A1); -DigitalIn button1(D9); -DigitalIn button2(D10); +DigitalIn button1(D13); +DigitalIn button2(D12); Ticker potmeterreadout; Ticker encoderreadout; Encoder motor1(PTD0,PTC4); // motor 1 is from encoder, otherwise it would be a pain in the ass to change all that code to motorencoder @@ -28,8 +28,13 @@ void readpot(){ potvalue = pot.read(); //position = motor1.getPosition(); - pc.printf("pos: %d, speed %f \r\n",motor1.getPosition(), motor1.getSpeed()); + pc.printf("pos: %d, speed %f reference velocity = %.2f\r\n",motor1.getPosition(), motor1.getSpeed(), potvalue); + led1 = potvalue; + motorspeed = potvalue; } +void writevalues(){ + + } int main() { @@ -39,8 +44,7 @@ //float motorspeed = 0.0f; while (true) { - led1 = potvalue; - motorspeed = potvalue; + //pc.printf("reference velocity = %.2f\r\n", potvalue);