Hello,
I'm controlling an LED RGB strip with an Uno. When an input goes High, I'd like to write 'black" to the LEDs (turn them off). I've got the LED bit sorted, but I can't seem to manage how to get the loop to instantly respond to the input state change. Of course, it's only checking the state at the top of the loop - is there some way to get the loop to respond as soon as the input goes high? Many thanks for your time, here's the relevant code:
void loop()
{
if (digitalRead(LORCue1Pin)==LOW)
{
Serial.print("Enable received from LOR, beginning sequence");
Serial.println("");
delay(1000);
dither(strip.Color(0,32,0), 200); // green, slow - to make brighter, increase each rgb param by x2
dither(strip.Color(15,0,32), 200); // violet, slow
dither(strip.Color(15,0,0), 200); // red, slow
dither(strip.Color(15,0,32), 200); // violet, slow
dither(strip.Color(0,32,0), 200); // green, slow
dither(strip.Color(15,0,32), 200); // violet, slow
dither(strip.Color(15,0,0), 200); // red, slow
dither(strip.Color(15,0,32), 200); // violet, slow
scanner(0,32,0, 300); // green, slow
}
else (digitalRead(LORCue1Pin)==HIGH);
{
Serial.print("Enable dropped from LOR, stopping sequence");
Serial.println("");
delay(1000);
for (int i = 0; i < 160; i++)
{
strip.setPixelColor(i, 0,0,0);
strip.show();
}
}
}