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:
- 5:047db32db712
- Parent:
- 4:0c27632b453a
- Child:
- 6:3c9569087274
diff -r 0c27632b453a -r 047db32db712 main.cpp --- a/main.cpp Tue Sep 25 15:27:39 2018 +0000 +++ b/main.cpp Tue Sep 25 15:39:40 2018 +0000 @@ -6,25 +6,25 @@ FastPWM pin5(D5); AnalogIn pot1(A1); -//AnalogOut pot2(A2); +AnalogIn pot2(A2); DigitalOut pin4(D4); //float u = pot1; void draai(){ - float u = pot1; + float u = 2.0*(pot1 - 0.5); - //if (u>0){ - // pin4 = true; - // } - // else if(u<0){ - // pin4 = false; - // } - pin4 = true;// u > 0.0f; + if (u>0){ + pin4 = true; + } + else if(u<0){ + pin4 = false; + } + pin5 = fabs(u); } int main(){ - pin5.period_us(60); + pin5.period_us(50); motor.attach(draai, 0.001); while(true){