joystick_bjk

Dependencies:   mbed VL53L1X

Revision:
5:fb5a46e37787
Parent:
4:97a11deb0ab7
Child:
6:beddcb25ad4e
--- a/main.cpp	Fri Sep 06 01:39:40 2019 +0000
+++ b/main.cpp	Mon Sep 09 07:53:29 2019 +0000
@@ -5,7 +5,7 @@
 #define DEBUG
 #define BT_MODE
 
-#define ToF_MODE
+//#define ToF_MODE
 
 
 #ifdef DEBUG
@@ -13,9 +13,10 @@
 #endif
 
 Serial bt1(BLUETOOTH1_TX, BLUETOOTH1_RX);        //input  (motor control)
+
+#ifdef ToF
 Serial bt2(BLUETOOTH2_TX, BLUETOOTH2_RX);        //output (ToF result)
 
-#ifdef ToF
 VL53L1X tof(ToF_I2C_SDA, ToF_I2C_SCL);    //F303K8(PB_7, PB_6), F072RB(PB_9, PB_8)
 
 DigitalOut Xshut1(ToF_XShut_1);
@@ -51,11 +52,14 @@
     throttleR = 0; 
     #ifdef BT_MODE
         bt1.baud(UART_BAUD);
+        
+        bt1.attach(&rxData, Serial::RxIrq);
+        
+    #endif
+    #ifdef ToF_MODE
         bt2.baud(UART_BAUD);
-        bt1.attach(&rxData, Serial::RxIrq);
         //bt2.attach(&rxData2, Serial::RxIrq);
     #endif
-
     int dis1, dis2, dis3;
     
     reverseR = 0;