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
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
*/
// Version 1.1, 20.09.2019, AK-Homberger
// Version 1.2, 21.09.2019, AK-Homberger
#include <avr/pgmspace.h>
#include <RCSwitch.h>
@@ -52,9 +51,9 @@ const PROGMEM uint16_t ST_BeepOn[] = { 0x1A8, 0x53, 0x80, 0x00, 0x00, 0xD3 };
const PROGMEM uint16_t ST_BeepOff[] = { 0x1A8, 0x43, 0x80, 0x00, 0x00, 0xC3 };
boolean blink = true;
long unsigned int timer=0;
long unsigned int timer1=0;
long unsigned int timer2=0;
long unsigned int timer = 0;
long unsigned int timer1 = 0;
long unsigned int timer2 = 0;
boolean sendDatagram(const uint16_t data[]) {
int i = 0; int j = 0;
@@ -145,6 +144,9 @@ void setup()
pinMode(9, OUTPUT); // LED to show if keys are received
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.setTextColor(WHITE);
Display("Start", 4);
@@ -153,12 +155,21 @@ void setup()
}
void Beep(void) {
sendDatagram(ST_BeepOn);
digitalWrite(20, HIGH);
delay(150);
sendDatagram(ST_BeepOff);
digitalWrite(20, LOW);
}
void loop()
{
int i;
char AWS[4] = "";
timer++;timer1++;timer2++;
timer++; timer1++; timer2++;
if (timer > 200000 ) {
Display("---", 7); // Show --- after about two seconds when no wind data is received
@@ -198,41 +209,31 @@ void loop()
if (value == Key_Plus_1) {
Display("+1", 7);
sendDatagram(ST_Plus_1);
sendDatagram(ST_BeepOn);
delay(150);
sendDatagram(ST_BeepOff);
Beep();
}
if (value == Key_Minus_10) {
Display("-10", 7);
sendDatagram(ST_Minus_10);
sendDatagram(ST_BeepOn);
delay(150);
sendDatagram(ST_BeepOff);
Beep();
}
if (value == Key_Plus_10) {
Display("+10", 7);
sendDatagram(ST_Plus_10);
sendDatagram(ST_BeepOn);
delay(150);
sendDatagram(ST_BeepOff);
Beep();
}
if ((value == Key_Auto) && (Auto_Standby_Support==1)) {
if ((value == Key_Auto) && (Auto_Standby_Support == 1)) {
Display("Auto", 7);
sendDatagram(ST_Auto);
sendDatagram(ST_BeepOn);
delay(150);
sendDatagram(ST_BeepOff);
Beep();
}
if ((value == Key_Standby) && (Auto_Standby_Support==1)) {
if ((value == Key_Standby) && (Auto_Standby_Support == 1)) {
Display("Standby", 7);
sendDatagram(ST_Standby);
sendDatagram(ST_BeepOn);
delay(150);
sendDatagram(ST_BeepOff);
Beep();
}
i = 0;
@@ -243,4 +244,3 @@ void loop()
}
}
}