【これは旧バージョンです】 AndroidのBLEラジコンプロポアプリ「BLEPropo」と接続し、RCサーボとDCモータを制御するプログラムです。 mbed HRM1017で動作を確認しています。 BLEPropo → https://github.com/lipoyang/BLEPropo
Fork of BLE_RCBController2 by
BLEを使ったAndroid用ラジコンプロポアプリ「BLEPropo」に対応するmbed HRM1017用ファームウェアです。
BLEPropoは、GitHubにて公開中。
https://github.com/lipoyang/BLEPropo
ラジコンは、mbed HRM1017とRCサーボやDCモータを組み合わせて作ります。
Diff: main.cpp
- Revision:
- 9:ed80cfb10df8
- Parent:
- 7:6115339996eb
- Child:
- 12:35292b16b401
--- a/main.cpp Wed Sep 17 00:54:13 2014 +0000 +++ b/main.cpp Wed Sep 17 04:35:28 2014 +0000 @@ -1,3 +1,34 @@ +/* + * This repo was forked from jksoft/BLE_RCBController2. + * The copyrights of the original repo belongs to Junichi Katsu. + */ + +/* + * Copyright (C) 2014 Bizan Nishimura (@lipoyang) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Library Dependencies: + * - BLE_API + * - HRM1017 + * - HRM1017/projectconfig.h + * connection interval constants are modified. (No need?) + * CFG_GAP_CONNECTION_MIN_INTERVAL_MS 30 + * CFG_GAP_CONNECTION_MAX_INTERVAL_MS 50 + */ + #include "mbed.h" #include "BLEDevice.h" @@ -16,6 +47,9 @@ static const uint8_t UUID_BLUEPROPO_STICK[] = { 0x74, 0x25, 0xfb, 0xa0, 0x72, 0x15, 0x41, 0x36, 0xaa, 0x3f, 0x07, 0x2a, 0xa0, 0x7d, 0x93, 0x54 }; +// Device Name (for display) +#define DEVICE_NAME "MiniSteer HRM1017" + // BluePropo::Stick data structure union StickData { @@ -137,7 +171,7 @@ ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED); ble.setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED); ble.accumulateAdvertisingPayload(GapAdvertisingData::SHORTENED_LOCAL_NAME, - (const uint8_t *)"MiniSteer HRM1017", sizeof("MiniSteer HRM1017") - 1); + (const uint8_t *)DEVICE_NAME, sizeof(DEVICE_NAME) - 1); ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_16BIT_SERVICE_IDS, (const uint8_t *)UUID_BLUEPROPO, sizeof(UUID_BLUEPROPO)); ble.setAdvertisingInterval(160); /* 100ms; in multiples of 0.625ms. */