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.
Dependents: ROCO104_Buggy BuggyDesign
Diff: clickers.cpp
- Revision:
- 3:91541ffdf9a5
- Parent:
- 2:2571dd52276f
- Child:
- 4:595e353826e5
diff -r 2571dd52276f -r 91541ffdf9a5 clickers.cpp
--- a/clickers.cpp Fri Mar 06 16:54:11 2020 +0000
+++ b/clickers.cpp Tue Mar 17 13:13:46 2020 +0000
@@ -10,23 +10,35 @@
extern int mm;
extern void dist();
extern bool rStopped, fStopped;
-
+int countDis = 0;
void RevStop()
{
- while (microswitch1 == true)
+ if (microswitch1 == true)
{
microswitch1.read();
Wheel.Stop();
rStopped = true;
+ dist();
}
-
+}
void FwdStop()
{
- while (mm<= 500)
+ dist();
+ if (mm<= 500)
+ {
+ countDis++;
+ dist();
+ }
+ else if (mm<= 500 && countDis > 20)
{
- ultra_sonic_distance();
Wheel.Stop();
- fStopped = true
+ fStopped = true;
+ dist();
+ }
+ else
+ {
+ countDis = 0;
+ fStopped = false;
dist();
}
}
\ No newline at end of file