1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-01 12:24:14 +01:00

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

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);