ESP32 and WS2811: init in macro not working

Any bugs you encounter with Flowcode should be discussed here.
stefan.erni
Valued Contributor
Posts: 758
http://meble-kuchenne.info.pl
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

ESP32 and WS2811: init in macro not working

Post by stefan.erni »

Hi to All

Ws2811 is a RGB Led.
It means that the LED can light up red, green or blue. Compinations can also be made.
Controlled with only one pin from the ESP32. Each LED also has an input and output so that many LEDs can be connected in series.
Flowcode supports this very comfortably with one component.
Unfortunately, for some reason the LED component cannot be initialised in the macro but only in the main.
However, the comands for the colour and brightness can be easily used in macros

regards

Stefan

Testet 100times....
Snag_673fa4.png
Snag_673fa4.png (25.69 KiB) Viewed 1219 times

Steve-Matrix
Matrix Staff
Posts: 1253
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 167 times
Been thanked: 277 times

Re: ESP32 and WS2811: init in macro not working

Post by Steve-Matrix »

Perhaps there needs to be a delay or some other code happening before the Initialise() macro is called.

What is within your Init() macro? And does it matter if the Initialise() is at the start or end of that macro?

stefan.erni
Valued Contributor
Posts: 758
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: ESP32 and WS2811: init in macro not working

Post by stefan.erni »

I have tested with delay before and after many times.
But it only helped to put the component init into the main.
Even if I switch from main to macro without or with a delay, it only works if the component init, is in the main part.
It is not a big problem, the LED works perfectly after that.

chipfryer27
Valued Contributor
Posts: 1147
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 284 times
Been thanked: 412 times

Re: ESP32 and WS2811: init in macro not working

Post by chipfryer27 »

Hi

Does it fail to compile if in the Macro or does it just not work (initialise)?

Using a PIC it compiles in either.

Regards

stefan.erni
Valued Contributor
Posts: 758
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: ESP32 and WS2811: init in macro not working

Post by stefan.erni »

Hi Lain

It's compile always, just the led is not working.
What also happened a few times was that the LED lit up at full power in white.
At the moment it seems to be working and I realise when it's not.
I'm not sure if it has to do with the ESP-IDF 5.12

In my project, the LED has many functions.
1. red flash, warning , if no sd-card is inserted
2. green switched on, Ok reayd for recording
3. red, when recording is running
4. blue flash if Bluetooth command is receiving.

Steve-Matrix
Matrix Staff
Posts: 1253
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 167 times
Been thanked: 277 times

Re: ESP32 and WS2811: init in macro not working

Post by Steve-Matrix »

Also, what if the Initialise() is in Main but comes before the Init() macro? Does it work ok then?

stefan.erni
Valued Contributor
Posts: 758
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: ESP32 and WS2811: init in macro not working

Post by stefan.erni »

Yes !
Attachments
Snag_d34861.png
Snag_d34861.png (33.73 KiB) Viewed 1201 times
Snag_d33248.png
Snag_d33248.png (32.09 KiB) Viewed 1201 times
Snag_d3121e.png
Snag_d3121e.png (31.55 KiB) Viewed 1201 times

stefan.erni
Valued Contributor
Posts: 758
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: ESP32 and WS2811: init in macro not working

Post by stefan.erni »

it's not the first time I had problems with the led but it was working again, without knowing why

https://flowcode.co.uk/forums/viewtopic.php?f=5&t=2315

stefan.erni
Valued Contributor
Posts: 758
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: ESP32 and WS2811: init in macro not working

Post by stefan.erni »

Hi Steve
A problem again with the ESP32 (upgrade?) and WS2811.

on an another board with an ESP32 pico, before the led was working nice. now the led color can just change before init Bluetooth.
After the init Bluetooth, if I set the led to blue, the led is just dark.
If i remove the command to set blue the led is correct green.
This was working nice before....

I use the led mainly to indicate
blue, the bluetooth is working,
green, the recorder is ready for recording
red, recording in progress
Flashing, no SD card inserted
for me it is important that the led works correctly
Attachments
Snag_1528cf.png
Snag_1528cf.png (26.69 KiB) Viewed 391 times

Steve-Matrix
Matrix Staff
Posts: 1253
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 167 times
Been thanked: 277 times

Re: ESP32 and WS2811: init in macro not working

Post by Steve-Matrix »

Sorry, Stefan. I don't use that LED component. I will ask here and see if anyone else has any idea to solve your problem.

Post Reply