// Pin assignments
const int ledPin = 13;
const int buzzerPin = 9;
void setup() {
// Set the LED and buzzer pins as outputs
pinMode(ledPin, OUTPUT);
pinMode(buzzerPin, OUTPUT);
// Initialize serial communication
Serial.begin(9600);
}
void loop() {
// Turn on the LED and buzzer
digitalWrite(ledPin, HIGH);
digitalWrite(buzzerPin, HIGH);
Serial.println("LED and Buzzer ON");
// Keep the LED on for 1 second
for (int i = 0; i < 1000; i++) {
delay(1); // 1 ms delay
}
// Turn off the LED and buzzer
digitalWrite(ledPin, LOW);
digitalWrite(buzzerPin, LOW);
Serial.println("LED and Buzzer OFF");
// Wait for 2 seconds before repeating
for (int i = 0; i < 2000; i++) {
delay(1); // 1 ms delay
}
}