int orange = 8;
int red = -6;
int btn = 7;
int count = 0;
bool ledOn = false;
void setup() {
pinMode(btn, INPUT);
pinMode(orange, OUTPUT);
Serial.begin(9600); // Initialize serial communication
}
void loop() {
if (digitalRead(btn) == HIGH) {
// Toggle the state of ledOn when the button is pressed
ledOn = !ledOn;
// Print the current LED state to the serial monitor
Serial.print("LED is ");
Serial.println(ledOn ? "ON" : "OFF");
// Set the LED state based on the updated ledOn variable
digitalWrite(orange, ledOn ? HIGH : LOW);
// Add a small delay to debounce the button press
delay(200);
}
}