Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of BLE_WallbotBLE_Challenge by
Revision 3:f707552ec50a, committed 2018-06-03
- Comitter:
- Dyotty
- Date:
- Sun Jun 03 07:04:34 2018 +0000
- Parent:
- 2:3c406d25860e
- Commit message:
- MPU6050????????
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MPU6050_Mod.lib Sun Jun 03 07:04:34 2018 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/mbed_tw_hoehoe/code/MPU6050_Mod/#01634c0bcfd9
--- a/TB6612FNG/TB6612.cpp	Fri Feb 20 00:07:48 2015 +0000
+++ b/TB6612FNG/TB6612.cpp	Sun Jun 03 07:04:34 2018 +0000
@@ -47,7 +47,7 @@
     
     if( speed > 0.0 )
     {
-        if( speed > 0.7)    speed = 0.7;
+        //if( speed > 0.7)    speed = 1.0;
         _pwm = speed;
         _fwd = 1;
         _rev = 0;
@@ -55,7 +55,7 @@
     }
     else if( speed < 0.0 )
     {
-        if( speed < -0.7)    speed = -0.7;
+        //if( speed < -0.7)    speed = -1.0;
         _pwm = -speed;
         _fwd = 0;
         _rev = 1;
--- a/main.cpp	Fri Feb 20 00:07:48 2015 +0000
+++ b/main.cpp	Sun Jun 03 07:04:34 2018 +0000
@@ -2,10 +2,14 @@
 #include "BLEDevice.h"
 #include "RCBController.h"
 #include "TB6612.h"
+#include "MPU6050.h"
 
 #define DBG 0
 
 BLEDevice  ble;
+
+MPU6050 mpu(I2C_SDA, I2C_SCL);
+
 #if DBG
 Serial  pc(USBTX, USBRX);
 #endif
@@ -19,7 +23,7 @@
 AnalogIn fsen2(P0_3);
 AnalogIn fsen3(P0_4);
 AnalogIn fsen4(P0_5);
-#if 0
+#if 1
 TB6612 left(P0_29,P0_23,P0_24);
 TB6612 right(P0_28,P0_30,P0_0);
 #else
@@ -404,6 +408,11 @@
         }
     }
 
+    // MPU6050 Initialize
+    mpu.initialize();
+    mpu.setAcceleroRange(MPU6050_ACCELERO_RANGE_8G);
+    mpu.setGyroRange(MPU6050_GYRO_RANGE_1000);
+
     ble.init(); 
     ble.onConnection(onConnected);
     ble.onDisconnection(onDisconnected);
    