Skip to content

Commit

Permalink
Merge pull request #55 from andysheen/master
Browse files Browse the repository at this point in the history
added catch to ensure led is fully off when at zero
  • Loading branch information
mikevanis authored Oct 12, 2020
2 parents aafdbef + 4da95d6 commit 37f4642
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
15 changes: 12 additions & 3 deletions rgbled.ino
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,23 @@ void rgbLedHandler() {
if (ledChanged[USERLED]) {
ledChanged[USERLED] = false;
saturation[USERLED] = 255;
leds[USERLED] = CHSV(hue[USERLED], saturation[USERLED], value[USERLED]);
if (value[USERLED] == 0) {
//Turn off
leds[USERLED] = CHSV(0, 0, 0);
} else {
leds[USERLED] = CHSV(hue[USERLED], saturation[USERLED], value[USERLED]);
}
FastLED.show();
}
if (ledChanged[REMOTELED]) {
ledChanged[REMOTELED] = false;
saturation[REMOTELED] = 255;
// value[REMOTELED] = 255;
leds[REMOTELED] = CHSV(hue[REMOTELED], saturation[REMOTELED], value[REMOTELED]);
if (value[REMOTELED] == 0) {
//turn off
leds[REMOTELED] = CHSV(0, 0, 0);
} else {
leds[REMOTELED] = CHSV(hue[REMOTELED], saturation[REMOTELED], value[REMOTELED]);
}
FastLED.show();
}
//long fade
Expand Down
1 change: 1 addition & 0 deletions utility.ino
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ void handleTouchEvent(AceButton* button, uint8_t eventType, uint8_t buttonState)
} else {
ledChanged[USERLED] = true;
fadeRGB(USERLED);
isFadingRGB[USERLED] = false;
startLongFade(USERLED);
socketIO_sendColour();
}
Expand Down

0 comments on commit 37f4642

Please sign in to comment.