#include <Arduino.h>
#define BUZZER 13
void buzzer_beep(int times)
{
for (int _i = 0; _i < times; _i++)
{
#define dt 50 // 0.1sec
int _j;
for (_j = dt; _j > 0; _j--)
{
digitalWrite(BUZZER, HIGH);
vTaskDelay(1);
digitalWrite(BUZZER, LOW);
vTaskDelay(1);
}
vTaskDelay(100);
}
}
void setup() {
Serial.begin(115200);
pinMode(BUZZER,OUTPUT);
Serial.println("*** Start Program ***");
}
void loop() {
buzzer_beep(1);
delay(5000);
}