Hi everyone,
I’m trying to get a code to run which sets a neopixel strip a certain colour when a button is pressed. I’ve connected the button no problem, but for some reason on being pressed it only sets one (the first) pixel the colour. What am I doing wrong in the code?
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
for (int i=0; i<strip.numPixels()-1; i++) {
strip.setPixelColor(0, 0, 255,0);
strip.show();
delay(1000);
strip.clear();
}
(Sorry, I am very new to this so it may be a very basic question!)
Would appreciate any help.