B4A Library [B4X] BLE 2 - Bluetooth Low Energy

Status
Not open for further replies.

KY Leng

Member
Licensed User
Longtime User
Hi,
i also work with HM-10 and i can send/receive data. On other side i have connected PIC P18F45K22 and also without any problem.
I'ts true, 24 bytes per frame is max.
Good to hear that you can do it.
However, could you please share some piece of code to read/send 24 byte data to PIC ?
Thank you in advance.
 

stari

Active Member
Licensed User
Longtime User
Good to hear that you can do it.
However, could you please share some piece of code to read/send 24 byte data to PIC ?
Thank you in advance.
Hi, yes i can. This is taken from another sample here on B4A communitty. I'ts only a working example, but i think i'ts Ok.
Example is for HM-10 module (BLE). At the end i send "*", because HM-10 don't send any terminating character.
 

Attachments

  • A_PIC.ZIP
    424.6 KB · Views: 814

KY Leng

Member
Licensed User
Longtime User
Hi, yes i can. This is taken from another sample here on B4A communitty. I'ts only a working example, but i think i'ts Ok.
Example is for HM-10 module (BLE). At the end i send "*", because HM-10 don't send any terminating character.
Thank you very much stari,
I will check it...
Best regards,
 

appie21

Active Member
Licensed User
Longtime User
Hello

is BLE2 same as Bluetooth 4.0?

Fir example if a headset support Bluetooth 4.0 I can work with this library
 

stari

Active Member
Licensed User
Longtime User
Hello

is BLE2 same as Bluetooth 4.0?

Fir example if a headset support Bluetooth 4.0 I can work with this library

The HM-10 is a readily available Bluetooth 4.0 module based on the Texas Instruments
CC2540 or CC2541 Bluetooth low energy (BLE) System on Chip (SoC).
I work with this module without problems.
 

appie21

Active Member
Licensed User
Longtime User
The HM-10 is a readily available Bluetooth 4.0 module based on the Texas Instruments
CC2540 or CC2541 Bluetooth low energy (BLE) System on Chip (SoC).
I work with this module without problems.

Hij

Thank you

I looking for a good headset
 

postasat

Active Member
Licensed User
Longtime User
Hi,
is it possible to connect to two or more of the same type of devices and read (with SetNotify) all of data and after that, assigning every data received at the right devices ?
(How to know who is sending the data)

Thanks.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User

ncabilis

Member
Licensed User
Longtime User
Hello.
Is it possible to get rssi value after bluetooth ble connected?
Thanks
 
Last edited:

ncabilis

Member
Licensed User
Longtime User
Thanks for your answer. I found a similar solution in BleExt library using the Manager.StartRssiTracking routine.
 

mczubel

Member
Licensed User
Longtime User
Good to hear that you can do it.
However, could you please share some piece of code to read/send 24 byte data to PIC ?
Thank you in advance.

Hi
I need to send AT commands to HM-10, this will be used as beacon and need write and rewrite
AT+IBE094900001

AT+IBE100374360
It is possible with ble2 or BLEext?
1000 thanks
 

ncabilis

Member
Licensed User
Longtime User
Hi
I need to send AT commands to HM-10, this will be used as beacon and need write and rewrite
AT+IBE094900001

AT+IBE100374360
It is possible with ble2 or BLEext?
1000 thanks

Assuming that you are using Arduino: From B4A, using BLEEXT, you can send a string to Arduino HM-10 BT.
Sub Button1_Click
Dim HMString As String
HMString = "1" & CRLF ' 20 characters max
If ConnectState = cstateConnect Then
Log("Write -> " & HMString)
writeCharacteristic.SetStringValue(HMString)
Manager.WriteCharacteristic(writeCharacteristic)
End If
End Sub

Now, on the Arduino side, you can read this character and to send the command: bluetooth.write('AT+IBE094900001');

#include <SoftwareSerial.h>

SoftwareSerial bluetooth(5, 6); // RX, TX
int info;
void setup()
{
Serial.begin(9600);
bluetooth.begin(9600);
}

void loop()
{
if (bluetooth.available()>0)
{
info = bluetooth.read();
if (info=='1') //READ STRING FROM B4A
{
bluetooth.write('AT+IBE094900001');
}

} //bt available
} //loop

If you have trouble, I can send you a general code in both languages (Arduino C, B4A)
 
Last edited:

mczubel

Member
Licensed User
Longtime User


yes, is arduino, next week hardware will be ready and I'll test it.
I'll let you know how it works
sorry my eng and
1000 thanks again!!!
 

coslad

Well-Known Member
Licensed User
Longtime User
Hi,

is it possible to connect two smartphone with BLE ?
 

freedom2000

Well-Known Member
Licensed User
Longtime User

Hi,

I am as well using BLE ext to write to the HM-10 and it works.

HOwever I would like to use only BLE2 to do the same thing.

How could we do to replace these lines to write to the HM10 with BLE2 ?

B4X:
  writeCharacteristic.SetStringValue(HMString)
        Manager.WriteCharacteristic(writeCharacteristic)
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…