I need to constantly loop an array of LED's and interrupt the loop (START/STOP) whenever I send a command through the serial port. *The code below I don't have the input doing anything. This only loops the LED's once then waits for an input. I want the LED's to constantly loop and when it receives an 's' to stop looping immediately, not to wait til the for loop is over. Any help would be great, I am new to this so please keep it simple.
int led[] = {22,23,24,25,26,27,28,29};
int input;
void setup() {
Serial.begin(9600);
for(int i = 0; i < 8; i++) pinMode(led*, OUTPUT);* } void loop() {
if (Serial.available() > 0) input = Serial.read();*
for(int i = 0; i < 8; i++){*
_ digitalWrite(led*, HIGH);_
_ delay(100);_ _ digitalWrite(led, LOW); delay(100); } }*_
You also need to use an index for your array in the pinMode and digitalWrite functions
The OP did use an index for the array. But they didn't read the forum guidelines and use code tags. As a result, the [ i ] dissapeared and the rest of the sketch is in italics because that's what [ i ] means unless it is inside code tags.