MRJJ / clickers

Dependents:   ROCO104_Buggy BuggyDesign

Revision:
2:2571dd52276f
Parent:
1:d5b76569b45c
Child:
3:91541ffdf9a5
diff -r d5b76569b45c -r 2571dd52276f clickers.cpp
--- 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