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:
omarrasheedk
Date:
Thu Aug 20 21:36:56 2015 +0000
Parent:
5:de5b38436960
Commit message:
Seeed bot bluetooth program

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu May 21 08:49:34 2015 +0000
+++ b/main.cpp	Thu Aug 20 21:36:56 2015 +0000
@@ -8,20 +8,19 @@
 
 BluetoothSerial bluetooth(D1, D0); // TX, RX
 
-#ifdef TARGET_NUCLEO_L053R8
-#define PWM1 D6 // Connect D6 and D8
-#define PWM2 D12
-#else // NUCLEO_F072RB
-#define PWM1 D8
-#define PWM2 D12
-#endif
-
-SeeedStudioShieldBot bot(
+/**SeeedStudioShieldBot bot(
     PWM1, D9, D11,     // Right motor pins (PwmOut, DigitalOut, DigitalOut) -> Motor 1
     PWM2, D10, D13,    // Left motor pins (PwmOut, DigitalOut, DigitalOut) -> Motor 2
     A0, A1, A2, A3, A4 // Sensors pins (all DigitalIn)
 );
+*/
+SeeedStudioShieldBot bot(
+    D8, D9, D11,             // Left motor pins
+    D12, D10, D13,            // Right motor pins
+    A0, A1, A2, A3, D4      // Sensors pins
+);
 
+DigitalOut led(D7);
 // Disable the feature by wiring A5 to GND
 DigitalIn ReadSensorsEnabled(A5, PullUp);
 
@@ -98,11 +97,12 @@
     // Enable motors
     bot.enable_right_motor();
     bot.enable_left_motor();
-  
+    
     PC_DEBUG(">>> Bluetooth setup...");
     bluetooth.setup();
     PC_DEBUG("done\n");
-  
+    
+
     PC_DEBUG(">>> Bluetooth in slave mode...");
     bluetooth.slave("bt_seeed_1");  // default PIN code: 0000
     PC_DEBUG("done\n");
@@ -112,7 +112,7 @@
     PC_DEBUG(">>> Bluetooth connect...");
     bluetooth.connect();
     PC_DEBUG("done\n");
-    
+    while(1){led = !led;wait(0.1);} 
     tick.attach(ReadCommand, 0.3); // Every 300 ms read Bluetooth command
 
     // Check if motors are alive
@@ -134,4 +134,5 @@
             stop = 0;
         }
     }
-}
+
+}
\ No newline at end of file