Description
I have a very simple setup, HiLetGo NodeMCU ESP32-s connected to a Adafruit RGB LED. three 220 ohm resisters, common anode. Sending a value of 0 to each PMW output should be full on and 255 is full off from all the examples I have seen. But thats not what I'm finding in testing. It seems at 255 I get a slight dim light and I have to move up to 256 for the LED to fully turn off. Example code:
uint8_t ledR = A4;
uint8_t ledG = A5;
uint8_t ledB = A18;
void setup()
{
Serial.begin(115200);
delay(10);
ledcAttachPin(ledR, 1);
ledcAttachPin(ledG, 2);
ledcAttachPin(ledB, 3);
ledcSetup(1, 12000, 8);
ledcSetup(2, 12000, 8);
ledcSetup(3, 12000, 8);
}
void loop() {
Serial.println("Sending RGB a value of 255 for common anode should turn off LED but doesn't.");
ledcWrite(1, 255);
ledcWrite(2, 255);
ledcWrite(3, 255);
delay(5000);
Serial.println("Sending RGB a value of 256 however does.");
ledcWrite(1, 256);
ledcWrite(2, 256);
ledcWrite(3, 256);
delay(5000);
}
Is this correct or am I missing something?