Skip to content

Commit 98592d4

Browse files
authored
Merge pull request #5116 from YakovL/patch-1
fix the boundary check
2 parents f3e657a + e8dc43e commit 98592d4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

examples/01.Basics/Fade/Fade.ino

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ void loop() {
3232
brightness = brightness + fadeAmount;
3333

3434
// reverse the direction of the fading at the ends of the fade:
35-
if (brightness == 0 || brightness == 255) {
36-
fadeAmount = -fadeAmount ;
35+
if (brightness <= 0 || brightness >= 255) {
36+
fadeAmount = -fadeAmount;
3737
}
3838
// wait for 30 milliseconds to see the dimming effect
3939
delay(30);

0 commit comments

Comments
 (0)