Thanks for all your help in getting me started,

Thanks for all your help in getting me started, I’m making progress! I have a question though that I’m struggling with. I’ve got this code that I have cobbled together to light a random LED on a ws2811 strip using a pushbutton - it activates on release as intended. The problem I am having though is that it lights an LED automatically at the beginning before I have pressed a push button and I can’t figure out why!

#include <FastLED.h>
#include <Bounce.h>

#define NUM_LEDS 50
#define ledPin 2

struct CRGB leds[NUM_LEDS];

const int buttonPin = 3;
Bounce pushbutton = Bounce(buttonPin, 10); // 10 ms debounce
int LIT_LED;

void setup() {
pinMode(buttonPin, INPUT_PULLUP);
FastLED.addLeds<WS2811, ledPin, RGB>(leds, NUM_LEDS);
randomSeed(analogRead(0));
}

byte previousState = HIGH;
unsigned int count = 0;
unsigned long countAt = 0; // when count changed
unsigned int countPrinted = 0; // last count printed

void loop()
{
if (pushbutton.update()) {
if (pushbutton.risingEdge()) {
count = count + 1;
countAt = millis();
}
} else {
LIT_LED = random(0,NUM_LEDS-1);
if (count != countPrinted) {
unsigned long nowMillis = millis();
if (nowMillis - countAt > 100) {
Serial.print("count: “);
Serial.print(count);
Serial.print(”, LED: ");
Serial.println(LIT_LED);
countPrinted = count;
leds[LIT_LED] = CRGB::BlueViolet;
FastLED.show();
}
}
}
}