Hi Ben
The Led's are working in a way.
But I can not set a led to white.
And the color are wrong.
The colors are swapped not with a system. Some are red, green, blue swapped.
The good thing is....
I can set all led to red if I do it this way
regard
Stefan
Set Led 1 to red,Led 2 to green,....Led 8 to white
ESP32 and component LED_SK6812RGBW2
-
- Valued Contributor
- Posts: 760
- http://meble-kuchenne.info.pl
- Joined: Wed Dec 02, 2020 10:53 am
- Has thanked: 150 times
- Been thanked: 171 times
-
- Valued Contributor
- Posts: 983
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 105 times
- Been thanked: 516 times
Re: ESP32 and component LED_SK6812RGBW2
Just tried to get a neo-pixel ring working using the ws2812 component (v5.1) - and compilation fails. My code 'above' now produces wrong timings as well and nothing works
I came up with this using the new 'RMT' interface from one of the example files - in Rainbow I demonstrate drawing a FC defined pixel buffer and also using the example 'rainbow' (which was my initial 'demo')
I needed a quick demo of a task in FC - so main is outputting timings to UART whilst Rainbow looks after the LEDs autonomously (here - displays red, green, blue, white, rainbow - and repeat)
Compilation - you need to add LED_strip_encoder.c and .h to project/main and point the include in supplementary code to the .h file (it's hard-coded here - so you'll need to change it to suit - there should be a way to set the include directory- INCLUDE_DIRS is maybe a clue ) (Note these files are from C:\espressif\frameworks\esp-idf-v5.1.1\examples\peripherals\rmt\led_strip\main - depending on your esp directory)
Also add led_strip_encoder.c to CMakeLists.txt (in project/main) which should end with the line
It was a quick-and-dirty hack so the pin used is in supplementary code - as is number of LEDs (pin 21 and 24 here) - display will take any number (and count is number of bytes not LEDs) The LEDs I have seem to take GRB data? - and timings are in led_strip_encoder.c (ws2812 here)
The naming is a bit 'odd' - I called the initialisation code create_rainbow, the draw 'rainbow' rainbow and output an array 'display'
Random file naming going on - sorry...
To create the directories - attempt to compile the .fcfx file (which will fail) then extract the zip file to project_name/main (and I'm assuming you'll change sk6812 (1) to something more memorable)
Martin
I came up with this using the new 'RMT' interface from one of the example files - in Rainbow I demonstrate drawing a FC defined pixel buffer and also using the example 'rainbow' (which was my initial 'demo')
I needed a quick demo of a task in FC - so main is outputting timings to UART whilst Rainbow looks after the LEDs autonomously (here - displays red, green, blue, white, rainbow - and repeat)
Compilation - you need to add LED_strip_encoder.c and .h to project/main and point the include in supplementary code to the .h file (it's hard-coded here - so you'll need to change it to suit - there should be a way to set the include directory- INCLUDE_DIRS is maybe a clue ) (Note these files are from C:\espressif\frameworks\esp-idf-v5.1.1\examples\peripherals\rmt\led_strip\main - depending on your esp directory)
Code: Select all
#include "driver/rmt_tx.h"
#include "R:\sk6812_(1)\main\led_strip_encoder.h" // Change this to suit your directory names!
#define RMT_LED_STRIP_RESOLUTION_HZ 10000000 // 10MHz resolution, 1 tick = 0.1us (led strip needs a high resolution)
#define RMT_LED_STRIP_GPIO_NUM 21 // This could be passed as an argument to 'create'
#define EXAMPLE_LED_NUMBERS 24 // Number of LEDs in 'string' change to argument?
Also add led_strip_encoder.c to CMakeLists.txt (in project/main) which should end with the line
Code: Select all
idf_component_register(SRCS "esp-project.c" "led_strip_encoder.c"
INCLUDE_DIRS "")
The naming is a bit 'odd' - I called the initialisation code create_rainbow, the draw 'rainbow' rainbow and output an array 'display'
Random file naming going on - sorry...
To create the directories - attempt to compile the .fcfx file (which will fail) then extract the zip file to project_name/main (and I'm assuming you'll change sk6812 (1) to something more memorable)
Martin