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.
Diff: main.cpp
- Revision:
- 3:d5480dc67a6d
- Parent:
- 2:2195a4abdf8c
--- a/main.cpp Wed Nov 28 21:00:21 2018 +0000
+++ b/main.cpp Wed Nov 28 21:08:04 2018 +0000
@@ -74,26 +74,23 @@
if((pos > (d_ang-3.0))) {
motor.pulsewidth(0);
slp = 0;
+
}
if( (pos > (d_ang+3.0))) {
slp = 1;
- while(pos > d_ang) {
dir = 1; //left??
motor.pulsewidth(.0005);
//pc.printf("pos: %.3f\n",pos);
+ Thread::wait(10);
pos = posi();
- }//while pos
- motor.pulsewidth(0);
}//if pos
if((pos < (d_ang-3.0)) && pos > 90.0) {
slp = 1;
- while(pos < d_ang) {
dir = 0; //right??
motor.pulsewidth(.0005);
//pc.printf("pos: %.3f\n",pos);
+ Thread::wait(10);
pos = posi();
- }//while pos
- motor.pulsewidth(0);
}
//***END OF JUST ADDED
ThisThread::sleep_until(121);