WLED/wled00/wled09_button.ino
cschwinne acfdb4ab75 improved structure
program split up  in 10 subfiles
2016-11-19 19:39:17 +01:00

28 lines
500 B
C++

void handleButton()
{
if (buttonEnabled)
{
if (digitalRead(buttonPin) == LOW && !buttonPressedBefore)
{
buttonPressedBefore = true;
if (bri == 0)
{
bri = bri_last;
} else
{
bri_last = bri;
bri = 0;
}
colorUpdated(2);
}
else if (digitalRead(buttonPin) == HIGH && buttonPressedBefore)
{
delay(15);
if (digitalRead(buttonPin) == HIGH)
{
buttonPressedBefore = false;
}
}
}
}