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

I would like to send the binary data "53,0x01" to the device via BLE using App Inventor, is it possible?

With WriteByte block or as String with WriteString.

Same question was asked in Kodular community

Thank you for your reply.
I tried various things but it didn't work.
Can you show me a sample blocks?

http://kio4.com/arduino/161_HM10_BLE.htm

I referenced this but it didn't work.

The interface between the host (Android) and device has the following specifications.
https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/bluetooth/peripheral_uart/README.html#peripheral-uart

I want to send 'S' + 0x01 = 5301 to the device according to this specification.

Note: The transmission format from Host to device is as follows.

Packet format (binary transmission):
- Message command (1 byte): S
- Identification information (1 byte): 0x01

Please download and post each of those event block(s)/procedures here ...
(sample video)

.

  1. Use WriteBytes instead of WriteStrings. The latter will convert the numbers into strings, which is not what you want.
  2. You say that the first byte should be S, but 53 (decimal) is 0x35, which is the number 5.

Thanks to @BeksOmega, you should be able to prefix the numbers in the blocks with 0x to make them hexadecimal.

1 Like

Thank you for your reply.
Can you show me the sample blocks?

sample block:
blocks
(should be draggable)

I changed to the following block, but somehow it is wrong.

I want to perform host/device communication like attached document...
However, the blocks above does not work that way. Can anyone tell me where the problem is?

What does a device actually look like when it sends a "write byte" like an attachment block?
Can anyone please tell me?

serviceUuid: 6e400001-b5a3-f393-e0a9-e50e24dcca9e
CharacteristicUuid: 6e400003-b5a3-f393-e0a9-e50e24dcca9e
Signed: false
Value: ox53 1

BLE1

Hello Noguchi

Can you tell us exactly what device you are sending to and what the command being sent does?

When you tell us the send did not work, how are you identifying the failure - does the device have a terminal attached that can show error messages?

Is the device programmable? Must it be programmed to receive the command you are sending?

Thank you for your reply.

Q: Can you tell us exactly what device you are sending to and what the command being sent does?
A: Please refer to the attached document for sending and receiving commands.
document: https://drive.google.com/file/d/1BJ0lUJGQBflrthEQNTwYh9Iw6JUjqLnU/view?usp=sharing

device: 

device

Q: When you tell us the send did not work, how are you identifying the failure - does the device have a terminal attached that can show error messages?
A: No response from device.

Q: Is the device programmable? Must it be programmed to receive the command you are sending?
A: Yes
The transmission/reception program on the device side has already been completed, and is operating normally on the PC emulator(Refer to attached document).

Hi

So can we see your Script for the device? Just because it works with a PC emulator (emulating what exactly?) does not mean it's 100% compatible with your Android Device.

What is your Android device? Make/Model/Android version.

The documentation is vast - we just need straight answers to straight questions. Please tell us what the command is supposed to do and indeed what the device does.

  1. RRBLE device & PC emulator infomation
    The information about the device and PC emulator received from the client is only the above attached device image and document.

  2. Android device information
    Maker: OPPO
    Device Name: OPPO A5 2020
    Android version: 9

  3. Command execution
    According to the documentation
    When you send the binary data of 'S' + 0x01 from the Android device to the RRBLE device side, the response of '5301E09304000b02BC020000000" will be returned from the RRBLE device side to the Android device.

Right - there is nothing set in your Blocks to receive that data, it's not a string?

  1. Need to remove all the redundant Blocks (Blocks that either send or receive strings)
  2. After the connection is established (before Send), add a Register For Bytes Block, signed = false. This will collect data whenever it is sent to the Android device.
    Use a Bytes Received Block to handle the data received.