iOSのBLEコントローラアプリ「RCBController」とmbed HRM1017を接続し、RCサーボモータを操作するテストプログラムです。

Dependencies:   BLE_API_Native_IRC Servo mbed

Fork of BLE_RCBController by Junichi Katsu

  • 古いBLEライブラリを使っているのでプラットフォームは”Nordic nRF51822”を選択してください。
  • ライブラリ類はUpdateしないでください。コンパイルエラーになります。

うまく接続できない時は、iPhone/iPadのBluetoothをOFF->ONしてキャッシュをクリアしてみてください。

/media/uploads/robo8080/img_1560.jpg

Committer:
jksoft
Date:
Thu Jul 10 14:21:52 2014 +0000
Revision:
0:8c643bfe55b7
??

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jksoft 0:8c643bfe55b7 1 /* mbed Microcontroller Library
jksoft 0:8c643bfe55b7 2 * Copyright (c) 2006-2013 ARM Limited
jksoft 0:8c643bfe55b7 3 *
jksoft 0:8c643bfe55b7 4 * Licensed under the Apache License, Version 2.0 (the "License");
jksoft 0:8c643bfe55b7 5 * you may not use this file except in compliance with the License.
jksoft 0:8c643bfe55b7 6 * You may obtain a copy of the License at
jksoft 0:8c643bfe55b7 7 *
jksoft 0:8c643bfe55b7 8 * http://www.apache.org/licenses/LICENSE-2.0
jksoft 0:8c643bfe55b7 9 *
jksoft 0:8c643bfe55b7 10 * Unless required by applicable law or agreed to in writing, software
jksoft 0:8c643bfe55b7 11 * distributed under the License is distributed on an "AS IS" BASIS,
jksoft 0:8c643bfe55b7 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
jksoft 0:8c643bfe55b7 13 * See the License for the specific language governing permissions and
jksoft 0:8c643bfe55b7 14 * limitations under the License.
jksoft 0:8c643bfe55b7 15 */
jksoft 0:8c643bfe55b7 16
jksoft 0:8c643bfe55b7 17 #include "mbed.h"
jksoft 0:8c643bfe55b7 18 #include "nRF51822n.h"
jksoft 0:8c643bfe55b7 19
jksoft 0:8c643bfe55b7 20 #include "btle/btle.h"
jksoft 0:8c643bfe55b7 21
jksoft 0:8c643bfe55b7 22 /**************************************************************************/
jksoft 0:8c643bfe55b7 23 /*!
jksoft 0:8c643bfe55b7 24 @brief Constructor
jksoft 0:8c643bfe55b7 25 */
jksoft 0:8c643bfe55b7 26 /**************************************************************************/
jksoft 0:8c643bfe55b7 27 nRF51822n::nRF51822n(void)
jksoft 0:8c643bfe55b7 28 {
jksoft 0:8c643bfe55b7 29 }
jksoft 0:8c643bfe55b7 30
jksoft 0:8c643bfe55b7 31 /**************************************************************************/
jksoft 0:8c643bfe55b7 32 /*!
jksoft 0:8c643bfe55b7 33 @brief Destructor
jksoft 0:8c643bfe55b7 34 */
jksoft 0:8c643bfe55b7 35 /**************************************************************************/
jksoft 0:8c643bfe55b7 36 nRF51822n::~nRF51822n(void)
jksoft 0:8c643bfe55b7 37 {
jksoft 0:8c643bfe55b7 38 }
jksoft 0:8c643bfe55b7 39
jksoft 0:8c643bfe55b7 40 /**************************************************************************/
jksoft 0:8c643bfe55b7 41 /*!
jksoft 0:8c643bfe55b7 42 @brief Initialises anything required to start using BLE
jksoft 0:8c643bfe55b7 43
jksoft 0:8c643bfe55b7 44 @returns ble_error_t
jksoft 0:8c643bfe55b7 45
jksoft 0:8c643bfe55b7 46 @retval BLE_ERROR_NONE
jksoft 0:8c643bfe55b7 47 Everything executed properly
jksoft 0:8c643bfe55b7 48
jksoft 0:8c643bfe55b7 49 @section EXAMPLE
jksoft 0:8c643bfe55b7 50
jksoft 0:8c643bfe55b7 51 @code
jksoft 0:8c643bfe55b7 52
jksoft 0:8c643bfe55b7 53 @endcode
jksoft 0:8c643bfe55b7 54 */
jksoft 0:8c643bfe55b7 55 /**************************************************************************/
jksoft 0:8c643bfe55b7 56 ble_error_t nRF51822n::init(void)
jksoft 0:8c643bfe55b7 57 {
jksoft 0:8c643bfe55b7 58 /* ToDo: Clear memory contents, reset the SD, etc. */
jksoft 0:8c643bfe55b7 59 btle_init();
jksoft 0:8c643bfe55b7 60
jksoft 0:8c643bfe55b7 61 return BLE_ERROR_NONE;
jksoft 0:8c643bfe55b7 62 }
jksoft 0:8c643bfe55b7 63
jksoft 0:8c643bfe55b7 64 /**************************************************************************/
jksoft 0:8c643bfe55b7 65 /*!
jksoft 0:8c643bfe55b7 66 @brief Resets the BLE HW, removing any existing services and
jksoft 0:8c643bfe55b7 67 characteristics
jksoft 0:8c643bfe55b7 68
jksoft 0:8c643bfe55b7 69 @returns ble_error_t
jksoft 0:8c643bfe55b7 70
jksoft 0:8c643bfe55b7 71 @retval BLE_ERROR_NONE
jksoft 0:8c643bfe55b7 72 Everything executed properly
jksoft 0:8c643bfe55b7 73
jksoft 0:8c643bfe55b7 74 @section EXAMPLE
jksoft 0:8c643bfe55b7 75
jksoft 0:8c643bfe55b7 76 @code
jksoft 0:8c643bfe55b7 77
jksoft 0:8c643bfe55b7 78 @endcode
jksoft 0:8c643bfe55b7 79 */
jksoft 0:8c643bfe55b7 80 /**************************************************************************/
jksoft 0:8c643bfe55b7 81 ble_error_t nRF51822n::reset(void)
jksoft 0:8c643bfe55b7 82 {
jksoft 0:8c643bfe55b7 83 wait(0.5);
jksoft 0:8c643bfe55b7 84
jksoft 0:8c643bfe55b7 85 /* Wait for the radio to come back up */
jksoft 0:8c643bfe55b7 86 wait(1);
jksoft 0:8c643bfe55b7 87
jksoft 0:8c643bfe55b7 88 return BLE_ERROR_NONE;
jksoft 0:8c643bfe55b7 89 }