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

22 lines
339 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>
#include <Arduino.h>
2021-04-27 15:29:06 +02:00
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);
}