Can App Inventor send binary data to a device via BLE?

All blocks are above (yesterday).

https://community-appinventor-mit-edu.ezproxy.canberra.edu.au/uploads/default/original/3X/6/5/657f8ce69f05776ba33df859bde280f5911c23fe.png

Attachment 1: Communication specifications between BLE device and Android device.

Attachment 2: The blocks created based on the specifications of Attachment 1.

Question: Are the serviceUuid and characteristicUuid settings in the attached blocks correct?
The specifications of Attachment 1 are serviceUuid and characteristicUuid
It is a hexadecimal number.
Is it necessary to change this to ASCII code (?) when setting in block?

Can anyone please tell me?

Attachment 1:


Attachment 2:
BLE Check2 block

Try nRF Connect app, with this app you can send values to your device.

Try send directly 53 and 01

ble53

Thank you for your reply.
The attached blocks that I created based on your app.
When I execute WriteBytes, there is no response or error from the device.
Is there a problem with Characteristic Uuid settings?

Have you tried the nRF app?

Have you tried this block?

Try

I also tried sending (53 1) using WriteBytes, but the same result: no response or error returned from the device.

I also tried sending (83 1) using WriteBytes, but the same result: no response or error returned from the device.

He wants to send 'S' = 0x53 = decimal 83

Hexadecimal (0x53 1) and decimal (83 1) give the same result.
I suspect there is a problem with the Characteristic Uuid settings. Can you please check it?

Properties of "TX CharacteristicUuid 6e400003-b5a3-f393-e0a9-e50e24dcca9e" is NOTIFY".
Is it possible to read device data using readBytes or registerFoBytes?

I don't know what the READ code is on your device, so I suggested that you send
53,1

For example in this code made for HM-10 and Arduino IDE, send 53,1 and receive:
53
1

Try send values from nRF app, click arrow...

I've solved the problem with a lot of advice from everyone.
Thank you very much.

Executing the EnableBluetooth block after the Connected event now returns the response from the device.

I am sorry that I overlooked the execution of EnableBluetooth and made a fuss.

Thanks for telling us what worked.

Never let a good mistake go to waste.

1 Like