Added Buzzer on pin 20 to give accoustical feedback when now buzzer in AP available.

This commit is contained in:
AK-Homberger
2019-09-21 12:01:00 +02:00
committed by GitHub
parent 0e7f1adcf2
commit 639985c0c2

View File

@@ -1,4 +1,3 @@
/* /*
This code is free software; you can redistribute it and/or This code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public
@@ -13,7 +12,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
// Version 1.1, 20.09.2019, AK-Homberger // Version 1.2, 21.09.2019, AK-Homberger
#include <avr/pgmspace.h> #include <avr/pgmspace.h>
#include <RCSwitch.h> #include <RCSwitch.h>
@@ -145,6 +144,9 @@ void setup()
pinMode(9, OUTPUT); // LED to show if keys are received pinMode(9, OUTPUT); // LED to show if keys are received
digitalWrite(9, HIGH); digitalWrite(9, HIGH);
pinMode(20, OUTPUT); // Buzzer to show if keys are received
digitalWrite(20, LOW);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x64 from Conrad else 3D) display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x64 from Conrad else 3D)
display.setTextColor(WHITE); display.setTextColor(WHITE);
Display("Start", 4); Display("Start", 4);
@@ -153,6 +155,15 @@ void setup()
} }
void Beep(void) {
sendDatagram(ST_BeepOn);
digitalWrite(20, HIGH);
delay(150);
sendDatagram(ST_BeepOff);
digitalWrite(20, LOW);
}
void loop() void loop()
{ {
int i; int i;
@@ -198,41 +209,31 @@ void loop()
if (value == Key_Plus_1) { if (value == Key_Plus_1) {
Display("+1", 7); Display("+1", 7);
sendDatagram(ST_Plus_1); sendDatagram(ST_Plus_1);
sendDatagram(ST_BeepOn); Beep();
delay(150);
sendDatagram(ST_BeepOff);
} }
if (value == Key_Minus_10) { if (value == Key_Minus_10) {
Display("-10", 7); Display("-10", 7);
sendDatagram(ST_Minus_10); sendDatagram(ST_Minus_10);
sendDatagram(ST_BeepOn); Beep();
delay(150);
sendDatagram(ST_BeepOff);
} }
if (value == Key_Plus_10) { if (value == Key_Plus_10) {
Display("+10", 7); Display("+10", 7);
sendDatagram(ST_Plus_10); sendDatagram(ST_Plus_10);
sendDatagram(ST_BeepOn); Beep();
delay(150);
sendDatagram(ST_BeepOff);
} }
if ((value == Key_Auto) && (Auto_Standby_Support == 1)) { if ((value == Key_Auto) && (Auto_Standby_Support == 1)) {
Display("Auto", 7); Display("Auto", 7);
sendDatagram(ST_Auto); sendDatagram(ST_Auto);
sendDatagram(ST_BeepOn); Beep();
delay(150);
sendDatagram(ST_BeepOff);
} }
if ((value == Key_Standby) && (Auto_Standby_Support == 1)) { if ((value == Key_Standby) && (Auto_Standby_Support == 1)) {
Display("Standby", 7); Display("Standby", 7);
sendDatagram(ST_Standby); sendDatagram(ST_Standby);
sendDatagram(ST_BeepOn); Beep();
delay(150);
sendDatagram(ST_BeepOff);
} }
i = 0; i = 0;
@@ -243,4 +244,3 @@ void loop()
} }
} }
} }