WallbotBLE_Challenge ホワイトボード消し版

Dependencies:   mbed

Fork of BLE_WallbotBLE_Challenge by JKSoft

Files at this revision

API Documentation at this revision

Comitter:
Dyotty
Date:
Sun Jun 03 07:04:34 2018 +0000
Parent:
2:3c406d25860e
Commit message:
MPU6050????????

Changed in this revision

MPU6050_Mod.lib Show annotated file Show diff for this revision Revisions of this file
TB6612FNG/TB6612.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- /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);