Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FastPWM mbed QEI biquadFilter HIDScope MODSERIAL
Diff: main.cpp
- Revision:
- 13:6556cd086d07
- Parent:
- 11:3efd6a324f16
- Child:
- 14:e21cb701ccb8
--- a/main.cpp Mon Oct 08 15:10:47 2018 +0000 +++ b/main.cpp Fri Oct 12 12:24:24 2018 +0000 @@ -1,8 +1,9 @@ #include "mbed.h" #include "FastPWM.h" #include "QEI.h" // Includes library for encoder - -Ticker motor; +#include "MODSERIAL.h" +#include "HIDScope.h" +#include "BiQuad.h" AnalogIn pot1(A1); AnalogIn pot2(A2); @@ -28,6 +29,7 @@ DigitalOut pin7(D7); // Motor 1 direction //float u1 = pot1; +Ticker motor; float u3 = 0.0; // Normalised variable for the movement of motor 3 void draaibuttons() @@ -38,19 +40,19 @@ */ if (button1 == 1) { if (button2 == 1) - { u3 = u3 + 0.1; //In stapjes van 0.1 + { u3 = u3 + 0.1f; //In stapjes van 0.1 pin3 = fabs(u3); - if (u3>1.0) - { u3 = 1.0; + if (u3>1.0f) + { u3 = 1.0f; } } } else if (button1 == 0) { if (button2 == 1) - { u3 = u3 - 0.1; + { u3 = u3 - 0.1f; pin3 = fabs(u3); - if (u3>1.0) - { u3 = 1.0; + if (u3>1.0f) + { u3 = 1.0f; } } }