Skip to content

Commit 11dcd5c

Browse files
authored
feat(ledc): Change LED fade amount and brightness limits
1 parent 49875c3 commit 11dcd5c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libraries/ESP32/examples/AnalogOut/LEDCSingleChannel/LEDCSingleChannel.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#define LEDC_CHANNEL 0
2727

2828
int brightness = 0; // how bright the LED is
29-
int fadeAmount = 5; // how many points to fade the LED by
29+
int fadeAmount = 4; // how many points to fade the LED by
3030

3131
void setup() {
3232
// Use single LEDC channel 0 for both pins
@@ -42,7 +42,7 @@ void loop() {
4242
brightness = brightness + fadeAmount;
4343

4444
// reverse the direction of the fading at the ends of the fade:
45-
if (brightness <= 0 || brightness >= 255) {
45+
if (brightness <= 0 || brightness >= 256) {
4646
fadeAmount = -fadeAmount;
4747
}
4848
// wait for 30 milliseconds to see the dimming effect

0 commit comments

Comments
 (0)