RCBControllerでモータを制御します。うおーるぼっとも動かせました。
Dependencies: BLE_API TB6612FNG2 mbed nRF51822
Fork of BLE_RCBController2 by
うまく接続できない時は、iPhone/iPadのBluetoothをOFF->ONしてキャッシュをクリアしてみてください。
ライブラリ類をUpdateするとコンパイル出来なくなります。インポートした物をそのまま使って下さい。
RCBControllerでうおーるぼっとを操縦する例
RCBControllerでの操縦は次の4種類あります。 それぞれうおーるぼっとの動きが異なりますので試してみてください。
- 左十字ボタン
- 左のみアナログ
- 右のみアナログ
- 両方アナログ
うおーるぼっと(LPC1768のソケット)とHRM1017の接続はこれです。
LPC1768 ー HRM1017
p11 ーーー P0_0
p12 ーーー P0_1
p13 ーーー P0_28
p14 ーーー P0_29
p21 ーーー P0_30
p22 ーーー P0_25
GND ーーー GND
HRM1017の電源はうおーるぼっとのUSBコネクタからとります。
HRM1017/nRF51GattServer.h@4:ebda47d22091, 2014-08-20 (annotated)
- Committer:
- jksoft
- Date:
- Wed Aug 20 13:41:01 2014 +0000
- Revision:
- 4:ebda47d22091
- Parent:
- nRF51822/nRF51GattServer.h@1:48f6e08a3ac2
?????????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jksoft | 1:48f6e08a3ac2 | 1 | /* mbed Microcontroller Library |
jksoft | 1:48f6e08a3ac2 | 2 | * Copyright (c) 2006-2013 ARM Limited |
jksoft | 1:48f6e08a3ac2 | 3 | * |
jksoft | 1:48f6e08a3ac2 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
jksoft | 1:48f6e08a3ac2 | 5 | * you may not use this file except in compliance with the License. |
jksoft | 1:48f6e08a3ac2 | 6 | * You may obtain a copy of the License at |
jksoft | 1:48f6e08a3ac2 | 7 | * |
jksoft | 1:48f6e08a3ac2 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
jksoft | 1:48f6e08a3ac2 | 9 | * |
jksoft | 1:48f6e08a3ac2 | 10 | * Unless required by applicable law or agreed to in writing, software |
jksoft | 1:48f6e08a3ac2 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
jksoft | 1:48f6e08a3ac2 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
jksoft | 1:48f6e08a3ac2 | 13 | * See the License for the specific language governing permissions and |
jksoft | 1:48f6e08a3ac2 | 14 | * limitations under the License. |
jksoft | 1:48f6e08a3ac2 | 15 | */ |
jksoft | 1:48f6e08a3ac2 | 16 | |
jksoft | 1:48f6e08a3ac2 | 17 | #ifndef __NRF51822_GATT_SERVER_H__ |
jksoft | 1:48f6e08a3ac2 | 18 | #define __NRF51822_GATT_SERVER_H__ |
jksoft | 1:48f6e08a3ac2 | 19 | |
jksoft | 1:48f6e08a3ac2 | 20 | #include "mbed.h" |
jksoft | 1:48f6e08a3ac2 | 21 | #include "blecommon.h" |
jksoft | 1:48f6e08a3ac2 | 22 | #include "ble.h" /* nordic ble */ |
jksoft | 1:48f6e08a3ac2 | 23 | #include "GattService.h" |
jksoft | 1:48f6e08a3ac2 | 24 | #include "public/GattServer.h" |
jksoft | 1:48f6e08a3ac2 | 25 | |
jksoft | 1:48f6e08a3ac2 | 26 | #define BLE_TOTAL_CHARACTERISTICS 10 |
jksoft | 1:48f6e08a3ac2 | 27 | |
jksoft | 1:48f6e08a3ac2 | 28 | class nRF51GattServer : public GattServer |
jksoft | 1:48f6e08a3ac2 | 29 | { |
jksoft | 1:48f6e08a3ac2 | 30 | public: |
jksoft | 1:48f6e08a3ac2 | 31 | static nRF51GattServer &getInstance() { |
jksoft | 1:48f6e08a3ac2 | 32 | static nRF51GattServer m_instance; |
jksoft | 1:48f6e08a3ac2 | 33 | return m_instance; |
jksoft | 1:48f6e08a3ac2 | 34 | } |
jksoft | 1:48f6e08a3ac2 | 35 | |
jksoft | 1:48f6e08a3ac2 | 36 | /* Functions that must be implemented from GattServer */ |
jksoft | 1:48f6e08a3ac2 | 37 | virtual ble_error_t addService(GattService &); |
jksoft | 1:48f6e08a3ac2 | 38 | virtual ble_error_t readValue(uint16_t handle, uint8_t buffer[], uint16_t *const lengthP); |
jksoft | 1:48f6e08a3ac2 | 39 | virtual ble_error_t updateValue(uint16_t, uint8_t[], uint16_t, bool localOnly = false); |
jksoft | 1:48f6e08a3ac2 | 40 | |
jksoft | 1:48f6e08a3ac2 | 41 | virtual ble_error_t setDeviceName(const uint8_t *deviceName); |
jksoft | 1:48f6e08a3ac2 | 42 | virtual ble_error_t getDeviceName(uint8_t *deviceName, unsigned *lengthP); |
jksoft | 1:48f6e08a3ac2 | 43 | virtual ble_error_t setAppearance(uint16_t appearance); |
jksoft | 1:48f6e08a3ac2 | 44 | virtual ble_error_t getAppearance(uint16_t *appearanceP); |
jksoft | 1:48f6e08a3ac2 | 45 | |
jksoft | 1:48f6e08a3ac2 | 46 | /* nRF51 Functions */ |
jksoft | 1:48f6e08a3ac2 | 47 | void eventCallback(void); |
jksoft | 1:48f6e08a3ac2 | 48 | void hwCallback(ble_evt_t *p_ble_evt); |
jksoft | 1:48f6e08a3ac2 | 49 | |
jksoft | 1:48f6e08a3ac2 | 50 | private: |
jksoft | 1:48f6e08a3ac2 | 51 | GattCharacteristic *p_characteristics[BLE_TOTAL_CHARACTERISTICS]; |
jksoft | 1:48f6e08a3ac2 | 52 | ble_gatts_char_handles_t nrfCharacteristicHandles[BLE_TOTAL_CHARACTERISTICS]; |
jksoft | 1:48f6e08a3ac2 | 53 | |
jksoft | 1:48f6e08a3ac2 | 54 | nRF51GattServer() { |
jksoft | 1:48f6e08a3ac2 | 55 | serviceCount = 0; |
jksoft | 1:48f6e08a3ac2 | 56 | characteristicCount = 0; |
jksoft | 1:48f6e08a3ac2 | 57 | }; |
jksoft | 1:48f6e08a3ac2 | 58 | |
jksoft | 1:48f6e08a3ac2 | 59 | nRF51GattServer(nRF51GattServer const &); |
jksoft | 1:48f6e08a3ac2 | 60 | void operator=(nRF51GattServer const &); |
jksoft | 1:48f6e08a3ac2 | 61 | }; |
jksoft | 1:48f6e08a3ac2 | 62 | |
jksoft | 1:48f6e08a3ac2 | 63 | #endif |