lorawan/sodaq_one/buzzer.ino

21 lines
281 B
Arduino
Raw Normal View History

2016-10-22 20:38:24 +00:00
#include <Arduino.h>
2016-11-12 19:01:48 +00:00
void setupBuzzer(int pin)
2016-10-22 20:38:24 +00:00
{
2016-11-12 19:01:48 +00:00
pinMode(pin, OUTPUT);
2016-10-22 20:38:24 +00:00
}
2016-11-12 19:01:48 +00:00
void buzzerOn(int pin) {
digitalWrite(pin, HIGH);
2016-10-22 20:38:24 +00:00
}
2016-11-12 19:01:48 +00:00
void buzzerOff(int pin) {
digitalWrite(pin, LOW);
2016-10-22 20:38:24 +00:00
}
2016-11-12 19:01:48 +00:00
void buzz(int pin, int ms) {
buzzerOn(pin);
2016-10-22 20:38:24 +00:00
delay(ms);
2016-11-12 19:01:48 +00:00
buzzerOff(pin);
2016-10-22 20:38:24 +00:00
}