Bluetooth program for the Seeed bot
Dependencies: BluetoothSerial SeeedShieldBot mbed
Fork of Seeed_BlueBot_demo by
Diff: main.cpp
- Revision:
- 4:5dd60bfc3cdd
- Parent:
- 3:68fe5b9e069a
- Child:
- 5:de5b38436960
--- 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;