Printing data as String received from Bluetooth


I'm new to the MIT app and I'm trying to send distance data from a sensor connected to an arduino via bluetooth to a mobile app.

As start I used this tutorial.

I have already managed to receive the data in the application, but only as array of bytes, but I would like to display the data as a String. In the Serial Bluetooth Terminal, the application works fine, but in the MIT app I can't do it. Anyone willing to advise me where I'm doing wrong? If I put the stringReceive function instead of the bytesReceive function, it doesn't show anything.

how it look:

how I want it to look:

My Arduino Code:

Code in MIT appinventor:

BasicIoTSetup.aia (197.0 KB)

Any help is appreciated.


You're using BLE in AI2, but I don't see any BLE software in your sketch.

Maybe use the Ai2 BlueTooth Client component and this simple sample?
Here is a simple BlueTooth text receiver sample, for single value per line:
initialize global message to

.P.S. There is also needed an initial scan for BlueTooth Devices and adding them to a ListView for user selection and connection.
Unfortunately, I don't have a ready sample of that.

I tried it with Ai2 BlueTooth Client component, but it cant find my device. I am using AT-09 BLE module.
BLE.aia (196.8 KB)

okey I figured out I have array of indexes from ASCII

[82, 97, 110, 103, 101, 32, ...] => R A N G E

but I have still no clue how to convert it to String of normal characters.

In the end I did it, solution for future. :heart:

You don't need any extensions or converters. Instead of the RegisterFor Bytes block, use RegisterForString... instead of the BytesReceived event, use StringReceived...

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.