Open JeanSolagnier opened 4 months ago
I narrowed the problem down to the removed functions "ledcSetup" and "ledcAttachPin". they are now merged together into "ledcAttach". https://docs.espressif.com/projects/arduino-esp32/en/latest/migration_guides/2.x_to_3.0.html#id2
one way to fix this is to manually pass in channel numbers into the function like this:
RGBLed led1(0, 1, 2, R1_PIN, G1_PIN, B1_PIN, RGBLed::COMMON_ANODE);
RGBLed led2(3, 4, 5, R2_PIN, G2_PIN, B2_PIN, RGBLed::COMMON_ANODE);
RGBLed led3(6, 7, 8, R3_PIN, G3_PIN, B3_PIN, RGBLed::COMMON_ANODE);
RGBLed::RGBLed(int ch1, int ch2, int ch3, int red, int green, int blue, bool common) : _ch1(ch1), _ch2(ch2), _ch3(ch3), _red(red), _green(green), _blue(blue), _common(common), _brightness(100)
{
#if defined(ESP32)
ledcSetup(_ch1, 5000, 8);
ledcSetup(_ch2, 5000, 8);
ledcSetup(_ch3, 5000, 8);
ledcAttachPin(_red, _ch1);
ledcAttachPin(_green, _ch2);
ledcAttachPin(_blue, _ch3);
#else
pinMode(_red, OUTPUT);
pinMode(_green, OUTPUT);
pinMode(_blue, OUTPUT);
#endif
}
The proper way would be to use the new esp32 IDF function, but I get compile errors. saying that 'ledcAttach' was not declared in this scope.
Hi there. I am trying to control 3x CA RGB leds but it appears to be impossible.
Setting led3 to blue sets all 3 LED's to blue.
I am using an esp32.
Can this library only handle one led?
kind regards, Jean