Programming Examples
Arduino program to interface led buzzer with Arduino or raspberry pi and turn ON LED for 2 second after every 3 second
Arduino program to interface led/buzzer with Arduino /raspberry pi and turn ON LED for 2 second after every 3 second
// Pin connected to the LED
const int ledPin = 13;
void setup() {
// Set the LED pin as an output
pinMode(ledPin, OUTPUT);
}
void loop() {
// Turn the LED ON
digitalWrite(ledPin, HIGH);
// Wait for 2 seconds
delay(2000);
// Turn the LED OFF
digitalWrite(ledPin, LOW);
// Wait for 3 second
delay(3000);
}
Output/ Explanation: