const int buttonPin = 7; // Pin connected to the button
const int ledPin = 8; // Pin connected to the LED
int buttonState = 0; // Variable to store button state
void setup() {
pinMode(buttonPin, INPUT); // Set button pin as input
pinMode(rlay, OUTPUT); // Set LED pin as output
}
void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
digitalWrite(relay, HIGH); // Turn LED on
} else {
digitalWrite(relay, LOW); // Turn LED off
}
}