// Define LED Pins (Update these based on your Wokwi wiring)
const int led1 = 5;
const int led2 = 17;
const int led3 = 16;
const int led4 = 27;
const int led5 = 26;
const int led6 = 14;
// Define Button Pin
const int buttonPin =34;
void setup() {
// Set LED pins as OUTPUT
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
pinMode(led6, OUTPUT);
// Set Button pin as INPUT
// If your button connects to GND when pressed, use INPUT_PULLUP
pinMode(buttonPin, INPUT_PULLUP);
}
void loop() {
// Read the state of the button
int buttonState = digitalRead(buttonPin);
// If button is pressed (LOW if using INPUT_PULLUP)
if (buttonState == HIGH) {
digitalWrite(led1, HIGH);
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);
digitalWrite(led4, HIGH);
digitalWrite(led5, HIGH);
digitalWrite(led6, HIGH);
} else {
// Turn all off when button is released
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
digitalWrite(led4, LOW);
digitalWrite(led5, LOW);
digitalWrite(led6, LOW);
}
}