Last updated: 2015/06/04
Provides simple API for nRF8001 BLE chip such as the BLE Shield and Blend Micro to exchange data via RBL TxRx Service to BLE Central device (e.g. iPhone 5).
Other 3rd party breakout breads may also be workable.
Tested with Arduino IDE 1.6.4 (we will only support this version).
You have to see this for installing libraries first. http://www.arduino.cc/en/Guide/Libraries
Method 1 - Using Library Manager
Follow this guide:
https://github.com/RedBearLab/BLEShield/blob/master/Docs/LibraryManager.pdf
Method 2 - Manual installation ("Importing a .zip Library")
Step 1: Get the latest release of Nordic nRF8001 SDK for Arduino.
Step 2: Get the latest release of RBL nRF8001 API.
Step 3: Load an example to your Arduino board.
The library structure and dependency: YourSketch.ino -> RBL_nRF8001 -> Nordic's BLE
Also, you can use Nordic's library directly such as: YourSketch.ino -> Nordic's BLE
Nordic also provides many examples and tutorials.
Read Nordic's BLE SDK for Arduino for details with tutorials to write your own services.
There are two Apps available from the Apple AppStore:
-
BLE Arduino
It is for the BLEFirmata sketch and works for iOS 6 -
BLE Controller
It is for the BLEController sketch and works for iOS 7
Before calling to ble_begin(), you can make use of ble_set_name("My BLE") to change the name.
Arduino UNO (328p), Leonardo (32u4), MEGA2560, DUE and their compatible.
ChipKit Uno32
void ble_begin();
- ble_begin starts the BLE stack and broadcasting the advertising packet
void ble_set_name(char *name);
- Call ble_set_name by giving name before calling to ble_begin to set the broadcasting name.
void ble_write(unsigned char data);
- ble_write sends a single byte data to the BLE Central.
void ble_write_bytes(unsigned char *data, unsigned char len);
- ble_write_bytes writes an array of bytes in data with length in len.
void ble_do_events();
- ble_do_events allows the BLE to process its events, if data is pending, it will be sent out.
int ble_read();
- ble_read reads a byte from BLE Central, It returns -1 if nothing to be read.
unsigned char ble_available();
- Returns the number of bytes ready for reading.
unsigned char ble_connected(void);
- ble_connected returns 1 if connected by BLE Central or 0 if not.
void ble_set_pins(uint8_t reqn, uint8_t rdyn);
- ble_set_pins is to specify the REQN and RDYN pins to the BLE chip, i.e. the jumper on the BLE Shield.
unsigned char ble_busy();
- ble_busy return the status if the BLE is busy, i.e. it is using the SPI interface. It is for using the SPI for other components at the same time.
void ble_reset(uint8_t reset_pin);
- ble_reset resets the BLE chip using the specified pin, reset_pin
Copyright (c) 2012-2014 RedBearLab
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.