【これは旧バージョンです】 AndroidのBLEラジコンプロポアプリ「BLEPropo」と接続し、RCサーボとDCモータを制御するプログラムです。 mbed HRM1017で動作を確認しています。 BLEPropo → https://github.com/lipoyang/BLEPropo

Dependencies:   BLE_API mbed

Fork of BLE_RCBController2 by Junichi Katsu

BLEを使ったAndroid用ラジコンプロポアプリ「BLEPropo」に対応するmbed HRM1017用ファームウェアです。
BLEPropoは、GitHubにて公開中。
https://github.com/lipoyang/BLEPropo
/media/uploads/lipoyang/blepropo_ui.png
ラジコンは、mbed HRM1017とRCサーボやDCモータを組み合わせて作ります。
/media/uploads/lipoyang/ble_wiring.png

Files at this revision

API Documentation at this revision

Comitter:
lipoyang
Date:
Thu Sep 11 14:02:31 2014 +0000
Parent:
5:572c91221792
Child:
7:6115339996eb
Commit message:
2nd test version

Changed in this revision

HRM1017/projectconfig.h Show annotated file Show diff for this revision Revisions of this file
Servo.lib 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
--- a/HRM1017/projectconfig.h	Wed Sep 10 04:11:28 2014 +0000
+++ b/HRM1017/projectconfig.h	Thu Sep 11 14:02:31 2014 +0000
@@ -115,8 +115,8 @@
     #define CFG_GAP_APPEARANCE                         BLE_APPEARANCE_GENERIC_TAG
     #define CFG_GAP_LOCAL_NAME                         "mbed HRM1017"
 
-    #define CFG_GAP_CONNECTION_MIN_INTERVAL_MS         50//500                      /**< Minimum acceptable connection interval */
-    #define CFG_GAP_CONNECTION_MAX_INTERVAL_MS         100//1000                     /**< Maximum acceptable connection interval */
+    #define CFG_GAP_CONNECTION_MIN_INTERVAL_MS         30//500                      /**< Minimum acceptable connection interval */
+    #define CFG_GAP_CONNECTION_MAX_INTERVAL_MS         50//1000                     /**< Maximum acceptable connection interval */
     #define CFG_GAP_CONNECTION_SUPERVISION_TIMEOUT_MS  4000                     /**< Connection supervisory timeout */
     #define CFG_GAP_CONNECTION_SLAVE_LATENCY           0                        /**< Slave Latency in number of connection events. */
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Servo.lib	Thu Sep 11 14:02:31 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/Servo/#36b69a7ced07
--- a/main.cpp	Wed Sep 10 04:11:28 2014 +0000
+++ b/main.cpp	Thu Sep 11 14:02:31 2014 +0000
@@ -47,26 +47,27 @@
 // pin asign
 DigitalOut tb6612_ain1(P0_28);
 DigitalOut tb6612_ain2(P0_29);
-PwmOut     tb6612_pwma(P0_30);
-PwmOut     servo_pwm  (P0_12);
+//PwmOut     tb6612_pwma(P0_30);
+//PwmOut     servo_pwm  (P0_12);
+PwmOut     servo_pwm  (P0_30);
 
 // DC motor driver (TB6612)
 void motor (float speed)
 {
     if (speed > 0) {
         // CW
-        tb6612_pwma = speed;
+        //tb6612_pwma = speed;
         tb6612_ain1 = 1;
         tb6612_ain2 = 0;
     } else
     if (speed < 0) {
         // CCW
-        tb6612_pwma = - speed;
+        //tb6612_pwma = - speed;
         tb6612_ain1 = 0;
         tb6612_ain2 = 1;
     } else {
         // stop
-        tb6612_pwma = 1;
+        //tb6612_pwma = 1;
         tb6612_ain1 = 0;
         tb6612_ain2 = 0;
 //        // break
@@ -114,7 +115,7 @@
         motor(m);
         float s = 0.5 + (float)stickData.value.lr /256.0;
         if(s<0) s=0;
-        servo(s);
+        //servo(s);
 	}
 		 
 }
@@ -144,10 +145,10 @@
                                     (const uint8_t *)UUID_BLUEPROPO, sizeof(UUID_BLUEPROPO));
     ble.setAdvertisingInterval(160); /* 100ms; in multiples of 0.625ms. */
     ble.startAdvertising();
-    ble.addService(serviceBluePropo);
+    ///ble.addService(serviceBluePropo);
 
 	// main loop (wait for BLE event)
     while (true) {
-        ble.waitForEvent();
+        //ble.waitForEvent();
     }
 }