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:
- 2:2571dd52276f
- Parent:
- 1:d5b76569b45c
- Child:
- 3:91541ffdf9a5
--- a/clickers.cpp Sat Feb 15 12:45:57 2020 +0000
+++ b/clickers.cpp Fri Mar 06 16:54:11 2020 +0000
@@ -1,21 +1,32 @@
#include "mbed.h"
#include "motor.h"
#include "clickers.h"
-#include "ultrasonic.h"
+#include "UltraSonic.h"
extern DigitalIn microswitch1; //Instance of the DigitalIn class called 'microswitch1'
extern DigitalIn microswitch2; //Instance of the DigitalIn class called 'microswitch2'
extern Motor Wheel;
extern Serial pc;
extern int mm;
-extern ultrasonic mu;
+extern void dist();
+extern bool rStopped, fStopped;
+
void RevStop()
{
- while (microswitch1 == true || mm <= 300)
+ while (microswitch1 == true)
{
- pc.printf("%dmm\n\r", mm);
- microswitch1.read();
- mu.checkDistance();
+ microswitch1.read();
Wheel.Stop();
+ rStopped = true;
+ }
+
+void FwdStop()
+{
+ while (mm<= 500)
+ {
+ ultra_sonic_distance();
+ Wheel.Stop();
+ fStopped = true
+ dist();
}
}
\ No newline at end of file