/*Press andPlat:Control the LED*/
// Define the pin numbers for the LED and buttons
int ledPin = 5; // Pin where the LED is connected
int buttonApin = 9; // Pin for button A (RED)
int buttonBpin = 8; // Pin for button B (YELLOW)
void setup()
{
// Set the LED pin as an output (we will control this pin)
pinMode(ledPin, OUTPUT);
// Enable internal pull-up resistors for the buttons
pinMode(buttonApin, INPUT_PULLUP);
pinMode(buttonBpin, INPUT_PULLUP);
}
void loop()
{
// Debounce delay
delay(50);
// Check if button A is pressed (LOW state)
if (digitalRead(buttonApin) == LOW)
{
// Turn on the LED if button A is pressed
digitalWrite(ledPin, HIGH);
}
// Check if button B is pressed (LOW state)
if (digitalRead(buttonBpin) == LOW)
{
// Turn off the LED if button B is pressed
digitalWrite(ledPin, LOW);
}
}