#define Ledmerah 2
#define buzzer 3
void setup() {
pinMode(Ledmerah, OUTPUT);
pinMode(buzzer, OUTPUT);
}
// class lampu berkedip
void lampu_kedip() {
digitalWrite(Ledmerah, HIGH);
tone(buzzer, 500);
delay(500);
digitalWrite(Ledmerah, LOW);
noTone(buzzer);
delay(500);
}
void loop() {
// put your main code here, to run repeatedly:
int count = 0; // Initialize a counter
while (count < 5) {
lampu_kedip(); // Call the function to blink the LED
delay(500); // Delay between each blink
count++; // Increment the counter
}
}