Merge pull request #5116 from YakovL/patch-1

fix the boundary check
This commit is contained in:
Arturo Guadalupi 2016-07-11 16:09:54 +02:00 committed by GitHub
commit cc6dfd239c
1 changed files with 2 additions and 2 deletions

View File

@ -32,8 +32,8 @@ void loop() {
brightness = brightness + fadeAmount; brightness = brightness + fadeAmount;
// reverse the direction of the fading at the ends of the fade: // reverse the direction of the fading at the ends of the fade:
if (brightness == 0 || brightness == 255) { if (brightness <= 0 || brightness >= 255) {
fadeAmount = -fadeAmount ; fadeAmount = -fadeAmount;
} }
// wait for 30 milliseconds to see the dimming effect // wait for 30 milliseconds to see the dimming effect
delay(30); delay(30);