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:
- 3:d39285fdd103
- Parent:
- 2:d8a552d1d33a
- Child:
- 4:0c27632b453a
--- a/main.cpp Tue Sep 25 14:08:49 2018 +0000 +++ b/main.cpp Tue Sep 25 14:46:02 2018 +0000 @@ -4,20 +4,27 @@ Ticker motor; -Ticker motor; FastPWM pin5(D5); AnalogOut pot1(pot1); AnalogOut pot2(pot2); +DigitalOut pin4(D4); float u = pot1 - pot2; - - +void draai(){ + u = pot1 - pot2; + if (u>0){ + pin4 = true; + } + else if(u<0){ + pin4 = false; + } + pin5 = fabs(u); +} int main(){ pin5.period_us(60); - - - - - + motor.attach(draai, 0.001); + while(true){ + pin5.write(u); + } } \ No newline at end of file