WriteBytes (Latest BLE extension)

Hi,
My maiden post here.
Just updated the BLE extension to the latest version. I am trying to send RGB (byte) values to a NeoPixel ledstrip. I have 3 RGB sliders (dec.base2 0-255) which I try to convert (each one separate) into a single byte to send it over BLE. On my ESP32 side I can read (BLE works fine with the Bluefruit Connect-LE app) the data that has been sent. Whatever I try (converted in all possibilities) App Invertor keep sending the dec.base2-ASCII-byte slider values. I am using the WriteBytes function in App Invertor. I read about (2017) some WriteBytes problems in the BLE extension so I thought maybe by updating the extension problems would have gone. Anyone who can explain/help

Henk Wijtman
Rotterdam
Netherlands

Hello Henk

We need to see your Blocks and the ESP32 Script.

Thanks for answering Chris,
corr. dec.base2.... = dec.base10.. off course (previous post)

The ESP32 side sketch works perfect with the BLE app 'connectLE' from Adafruit.
Adafruit format = ['!'] ['C'] [byte red] [byte green] [byte blue] first 2 are char values last 3 are bytes
Tried all possible converters left it in the PNG on binairy
Here are Block and script (only relevant, if you need all -big- let me know)


regards
Henk

Problem could be initialising global 'colorMessage' as text
Better to initialise it as number/integer. Do not know (yet) how to initialise as an array (list??)

I think you also need this to tackle.
Screen Shot 2022-05-02 at 13.15.38

Your colorMessage value is inappropriate for a WriteBytes operation, which needs a list of byte(0-255) values.

Here is a value procedure you will need, hopefully draggable directly into the Blocks Editor:
AsciiCHRASCprocedures.aia (4.0 KB)


asc_test

Your WriteBytes value parameter should be
make list(asc('!'),asc('C'),global red_value, global green_value, global blue_value)

Also, be aware that the convert number base 10 to binary block is a fraud. It outputs a fluffy text string of character '1's and '0's, not some compressed internal binary format.

1 Like