const int ledPin = 7;       // Pin where the LED is connected
unsigned long previousMillis = 0; // Stores the last time the LED state changed
const unsigned long interval = 500; // Interval in milliseconds (1 second)

bool ledState = false; // Current state of the LED

void setup() {
  pinMode(ledPin, OUTPUT); // Set the LED pin as an output
}

void loop() {
  unsigned long currentMillis = millis(); // Get the current time

  // Check if the interval has passed
  if (currentMillis - previousMillis >= interval) {
    previousMillis = currentMillis; // Save the current time

    // Toggle the LED state
    ledState = !ledState;
    digitalWrite(ledPin, ledState); // Update the LED
  }
}