arduino-toy-projects/traffic_lights/lib/lib.cpp

21 lines
318 B
C++
Raw Normal View History

2021-04-27 15:29:06 +02:00
//
// Created by Gabriel Augendre on 27/04/2021.
//
#include "lib.h"
void waitForButton() {
while (digitalRead(BUTTON) == HIGH) {}
}
void beep(int n) {
for (int i = 0; i < n; i++) {
tone(BUZZER, BUZZ_FREQUENCY, BUZZ_DURATION);
delay(BUZZ_DURATION * 2);
}
}
void beep() {
beep(1);
}