Hi to All
The LED is working nice and it's comfotable to use.
There is a little problem in a program with WS2812
I have made a test with WS2812
1.This LED can only be initialized in the main, it is not possible in the macro.
The LED maybe give some problems with the power management and maybe also with xtask
2.The LED is in the 3D Panel and it's always open the 3D panel, is there a way to config FC10 not to open the 3D Panel or move the LED to 2D Panel?
ESP32 and LED WS2811 (WS2812)
-
- Valued Contributor
- Posts: 1041
- http://meble-kuchenne.info.pl
- Joined: Wed Dec 02, 2020 10:53 am
- Has thanked: 198 times
- Been thanked: 219 times
-
- Valued Contributor
- Posts: 1559
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 138 times
- Been thanked: 742 times
Re: ESP32 and LED WS2811 (WS2812)
I attached 1 ws2812 - and can confirm that there us an issue...
Move WS2812::Initialise to a macro and it stops working - which is very odd. Not at all sure why it wouldn't work from a macro (as main is just a macro too!)
Also - the minimum number of LEDs seems to be 2?
I have done some code in the past using LEDs in a task (just as a demo) - I'll see if I can rummage it out.
Will fiddle a little more tomorrow.
Move WS2812::Initialise to a macro and it stops working - which is very odd. Not at all sure why it wouldn't work from a macro (as main is just a macro too!)
Also - the minimum number of LEDs seems to be 2?
I have done some code in the past using LEDs in a task (just as a demo) - I'll see if I can rummage it out.
Will fiddle a little more tomorrow.
-
- Valued Contributor
- Posts: 1559
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 138 times
- Been thanked: 742 times
Re: ESP32 and LED WS2811 (WS2812)
Attached is my demo of a LED 'handler' running in a task...
I used the 'new' RMT handler from the espressif framework - and it's all hidden in supplementary code...
The macro (runs here as a task) 'Rainbow' which creates an LED 'strip' - and then displays a few colours (from an array) briefly before running a rainbow scroller 500 times (and repeat).
Main - just outputs a time (using a timer interrupt to increase) every second - just to prove it's alive.
It's a little bit rough - pin for the LED strip and number of LEDs is defined in supplementary code - the properties should do a #define
Set to suit (here running one LED on pin 14)
display - takes an array of bytes (3 per LED) and outputs them to the LED strip. Here - I actually output 24 LEDs values (and at present it doesn't check for a correlation between this and number of LEDs defined) (As you can guess the initial demo used 24 LEDs
)
As you are using two LEDs - you could define a 6 byte array - and pass this - not time before work today. The macro SetAllLEDs demonstrates how the colours are set in the array (a SetLED(n, r,g,b) can be modelled on this.
Removing the 'rainbow' code would simplify things a bit.
Martin
I used the 'new' RMT handler from the espressif framework - and it's all hidden in supplementary code...
The macro (runs here as a task) 'Rainbow' which creates an LED 'strip' - and then displays a few colours (from an array) briefly before running a rainbow scroller 500 times (and repeat).
Main - just outputs a time (using a timer interrupt to increase) every second - just to prove it's alive.
It's a little bit rough - pin for the LED strip and number of LEDs is defined in supplementary code - the properties should do a #define
Code: Select all
#define RMT_LED_STRIP_GPIO_NUM 14
#define EXAMPLE_LED_NUMBERS 1
#define EXAMPLE_CHASE_SPEED_MS 10
display - takes an array of bytes (3 per LED) and outputs them to the LED strip. Here - I actually output 24 LEDs values (and at present it doesn't check for a correlation between this and number of LEDs defined) (As you can guess the initial demo used 24 LEDs

As you are using two LEDs - you could define a 6 byte array - and pass this - not time before work today. The macro SetAllLEDs demonstrates how the colours are set in the array (a SetLED(n, r,g,b) can be modelled on this.
Removing the 'rainbow' code would simplify things a bit.
Martin
- Attachments
-
- sk6812.fcfx
- (27.48 KiB) Downloaded 60 times
-
- Valued Contributor
- Posts: 1041
- Joined: Wed Dec 02, 2020 10:53 am
- Has thanked: 198 times
- Been thanked: 219 times
Re: ESP32 and LED WS2811 (WS2812)
Hi Martin
Thank you for your support
There are more and more 3Color leds. There are also different versions of the WS2812 These have different time values
WS2812
WS2812b
WS2812b-2020
WS2812e
But there are also other manufacturers with different time values and swapped RGB (GRB) like
B3DQ3BRG from Worldsemi
Flowcode can handle this so B3DQ3BRG works in custom mode nice
One wish would be that the component ws2811 would have a macro to change the custom values via macro.
So I can set the values depending on the dedected hardware.
The second wish would be a new component that would be in 2D panel and only has the custom times and RGB GRB selection macro and can be initialized in main and macro.
Thank you for your support
it is not so nice but i can work this wayI attached 1 ws2812 - and can confirm that there us an issue...
Move WS2812::Initialise to a macro and it stops working - which is very odd. Not at all sure why it wouldn't work from a macro (as main is just a macro too!)
There are more and more 3Color leds. There are also different versions of the WS2812 These have different time values
WS2812
WS2812b
WS2812b-2020
WS2812e
But there are also other manufacturers with different time values and swapped RGB (GRB) like
B3DQ3BRG from Worldsemi
Flowcode can handle this so B3DQ3BRG works in custom mode nice
One wish would be that the component ws2811 would have a macro to change the custom values via macro.
So I can set the values depending on the dedected hardware.
The second wish would be a new component that would be in 2D panel and only has the custom times and RGB GRB selection macro and can be initialized in main and macro.