// global variable that keeps track of if we are red (true) or green (false) let strandRed = true; function update(lights) { // Loop over all the lights for (let i=0; i<100; i++) { if (strandRed) { // Set red lights[i].rgb(1, 0, 0); } else { // Set green lights[i].rgb(0, 1, 0); } } strandRed = !strandRed; // Wait 500 ms until we get called again. return 500; }