Help with Slider App sending data to microcontroller

Always remember that \n (i.e. linefeed) character is the ASCII code 0x0A, so to change minimally your blocks, you could do as follows:
Send1ByteNumber 01 [in case of 1\n]
Send1ByteNumber 10 (i.e. 0A hex)

Or [in case of 0\n]:
Send1ByteNumber 0
Send1ByteNumber 10 (i.e. 0A hex)

Best wishes.

1 Like

If you want to send decimal 10 (line feed) as a special case, you will have to adjust your AI2 Slider to avoid numbers below 11.

Otherwise, your sketch would have no way to distinguish between load values that were sent for special purposes versus low (<11) values that came from the Slider.

Once you have adjusted your Slider minimum value, you would also have to adjust the map() call in the sketch to take into account the new range limits from the slider.

Why do you need this?

Have you reached the limits of usability of restricting your data traffic to single byte values?

Text affords richer values, with YAML style labelling, at the expense of learning to parse text in the sketch and to convert strings into numbers.

1 Like

As I wrote earlier, it would be easier to send text, not bytes. The Bluetooth component has a dedicated block for sending text. And the C++ language has the appropriate methods for converting text to numbers.

2 Likes

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