Bluetooth program for the Seeed bot

Dependencies:   BluetoothSerial SeeedShieldBot mbed

Fork of Seeed_BlueBot_demo by ST

Files at this revision

API Documentation at this revision

Comitter:
bcostm
Date:
Fri Oct 24 08:27:19 2014 +0000
Parent:
3:68fe5b9e069a
Child:
5:de5b38436960
Commit message:
Add option to disable the bot front sensors reading (default is enabled, wire A5 to GND to disable it)

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Oct 16 06:18:14 2014 +0000
+++ b/main.cpp	Fri Oct 24 08:27:19 2014 +0000
@@ -14,8 +14,11 @@
     A0, A1, A2, A3, A4 // Sensors pins (all DigitalIn)
 );
 
+// Disable the feature by wiring A5 to GND
+DigitalIn ReadSensorsEnabled(A5, PullUp);
+
 // Enable it for debugging on hyperterminal
-#define DEBUG 1
+#define DEBUG 0
 #if DEBUG == 1
 Serial pc(PC_10, PC_11);
 #define PC_DEBUG(args...) pc.printf(args)
@@ -104,10 +107,10 @@
     bot.right(speed);
     wait(0.2);
     bot.stopAll();
-
+    
     while (1) {
         // Stop the motors if a sensor has detected something.
-        if (!bot.rightSensor || !bot.inRightSensor || !bot.centreSensor || !bot.inLeftSensor || !bot.leftSensor)
+        if ((!bot.rightSensor || !bot.inRightSensor || !bot.centreSensor || !bot.inLeftSensor || !bot.leftSensor) && ReadSensorsEnabled)
         {
             if (!stop) bot.stopAll();
             stop = 1;