Buzz on water entrance

This commit is contained in:
Nico Schottelius 2016-09-17 07:14:13 +02:00
parent eed0c26237
commit 1a76d9d070
1 changed files with 12 additions and 1 deletions

View File

@ -75,8 +75,16 @@ void blink(int length) {
} }
void beep(int howlong) { void beep(int howlong) {
buzzOn();
delay(howlong);
buzzOff();
}
void buzzOn() {
digitalWrite(BUZZER, HIGH); digitalWrite(BUZZER, HIGH);
delay(howlong); }
void buzzOff() {
digitalWrite(BUZZER, LOW); digitalWrite(BUZZER, LOW);
} }
@ -248,6 +256,7 @@ void sendPacket(String packet){
void loop() { void loop() {
/* Announce begin of code */ /* Announce begin of code */
blink(20); delay(50); blink(20); delay(50);
blink(20); delay(50); blink(20); delay(50);
@ -264,8 +273,10 @@ void loop() {
String data_water; String data_water;
if(hasWater()) { if(hasWater()) {
data_water = String("water=1"); data_water = String("water=1");
buzzOn();
} else { } else {
data_water = String("water=0"); data_water = String("water=0");
buzzOff();
} }
debugSerial.println(data_water); debugSerial.println(data_water);