B4R Library rCurieBLE - Arduino 101 BLE

With this library it is simple to connect to the Arduino 101 board with an Android or iOS device.
Arduino 101 instructions: https://www.b4x.com/android/forum/posts/448783/

It is similar to B4i peripheral implementation: BLE (Bluetooth Low Energy) Peripheral

It creates a service (0001) with a readable characteristic (1001) and a writable characteristic (1002).

The NewData event is raised when a central device, the iOS or Android device, writes to the writable character.
The DataAvailable event on the central device is raised after a call to CuriePeripheral.Write.

Note that messages are limited to 20 bytes. Don't try to send more as it will break the connection.

A B4A + B4R example is attached.
 

Attachments

  • rCurieBLE.zip
    2.3 KB · Views: 742
  • B4R_BLE_Example.zip
    828 bytes · Views: 687
  • B4A_BLE_Example.zip
    8.3 KB · Views: 751

Erel

B4X founder
Staff member
Licensed User
Longtime User
Second example:

The Arduino 101 sends the measured temperature and pressure. It is connected to a BMP180 module.
The values are displayed on a connected iPhone.

upload_2016-9-5_11-29-55.png
 

Attachments

  • B4R_Weather.zip
    954 bytes · Views: 576
  • B4i_Weather.zip
    2.8 KB · Views: 564
Last edited:

Beja

Expert
Licensed User
Longtime User
20 bytes are more than enough for telemetry communication.

Thank you Erel so much
 
Last edited:

Beja

Expert
Licensed User
Longtime User
One question!
Can one use Uno or Mega? or it has to be 101 (I am using B4A only).
 

Beja

Expert
Licensed User
Longtime User
Thanks Erel,
I ordered 101.. hopefully will receive it tomorrow.
 

Beja

Expert
Licensed User
Longtime User
Hi Erel,
Yesterday I received my 101 and tried the Android/101 example above.. the B4A is working fine and stuck on "Trying to connect"
The 101 app cannot compile and said missing a library.. I copied the rCurieBLE (XML) in B4R library folder. besides I can't see the Arduino 101 in the Board selector list.
Any guidance appreciated.
Beja
 

Beja

Expert
Licensed User
Longtime User
Are you sure that the rCurieBLE library is checked?

Hi Erel,
I copied the rCurieBLE.xml file to the b4r libraries directory.. what else should I do?
Thanks in advance.
 

Beja

Expert
Licensed User
Longtime User
This is where I saved it, but not showing in the libraries pane.

B4R_LIBS.jpg
 

Beja

Expert
Licensed User
Longtime User
Thanks Erel, thumps up!
All working now except the 101 BT is not discovered.. I am posting this in the questions forum.
 

tigleth

Member
Licensed User
Longtime User
Hello
I set the 101 up in arduino and it runs sketches ; I ran the arduino example (on their site) for ble using nRF connect with my moto2g and it switches pin 13 led on and off. When I run BLEcentral it just stays on " trying to connect" . The phone sees the b4r_perif in the Bluetooth list. Any ideas will be appreciated.

Thank you
 

tigleth

Member
Licensed User
Longtime User
Hello

I am running the B4R program from the first post 1.b4r on 101 and BLEcentral on moto2g, stays on " trying to connect" . When I click connect on b4r i get the message
Error opening port
jssc.SerialPortException: Port name - COM4; Method name - openPort(); Exception type - Port not found. When I look in device manager COM4 is on the 101.

Thank you
 
Last edited:

tigleth

Member
Licensed User
Longtime User
Hello

the b4r example is working; tested with nRF Connect; led off on; it is the b4a example that stops at " trying to connect ".

Thank you
 
Top