const int doorSensorPin = 5; // Digital input pin for door position sensor
const int closedLedPin = 11; // Digital output pin for the "closed" LED
const int openLedPin = 12; // Digital output pin for the "open" LED
void setup() {
pinMode(doorSensorPin, INPUT);
pinMode(closedLedPin, OUTPUT);
pinMode(openLedPin, OUTPUT);
}
void loop() {
int doorStatus = digitalRead(doorSensorPin);
// Check the status of the door sensor
if (doorStatus == HIGH) {
// Door is closed, turn on the "closed" LED and turn off the "open" LED
digitalWrite(closedLedPin, HIGH);
digitalWrite(openLedPin, LOW);
} else {
// Door is open, turn off the "closed" LED and turn on the "open" LED
digitalWrite(closedLedPin, LOW);
digitalWrite(openLedPin, HIGH);
}
// You can add additional code here for other tasks or delays if needed.
}