From 46a4a8cfa1770333c9ac807e6e4f1b866d0111fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Wittstr=C3=B8m?= Date: Mon, 14 Aug 2023 13:43:51 +0200 Subject: [PATCH] merged display and buzzer files --- src/buzzer.cpp | 5 ----- src/{display.cpp => realMain.cpp} | 10 +++++++++- 2 files changed, 9 insertions(+), 6 deletions(-) delete mode 100644 src/buzzer.cpp rename src/{display.cpp => realMain.cpp} (77%) diff --git a/src/buzzer.cpp b/src/buzzer.cpp deleted file mode 100644 index 014f740..0000000 --- a/src/buzzer.cpp +++ /dev/null @@ -1,5 +0,0 @@ -const int buzzerPin = 9; - -void setup() { - pinMode(buzzerPin, OUTPUT_LOW); -} \ No newline at end of file diff --git a/src/display.cpp b/src/realMain.cpp similarity index 77% rename from src/display.cpp rename to src/realMain.cpp index 3df3c70..f78ea67 100644 --- a/src/display.cpp +++ b/src/realMain.cpp @@ -8,7 +8,7 @@ const char *password = "zwr33htm"; const char *mqtt_server = "192.168.24.215"; -// set the LCD number of columns and rows +const int buzzerPin = D0; int lcdColumns = 16; int lcdRows = 2; @@ -18,13 +18,21 @@ LiquidCrystal_I2C lcd(0x3f, lcdColumns, lcdRows); void setup(){ lcd.init(); lcd.backlight(); + pinMode(buzzerPin, OUTPUT); } void loop(){ + // LCD // set cursor to first column, first row lcd.setCursor(0, 0); // print message lcd.print("Piss off, ghosts!"); // clears the display to print new message lcd.clear(); + + // buzzer + digitalWrite(buzzerPin, HIGH); + delay(1000); + digitalWrite(buzzerPin, LOW); + delay(1000); } \ No newline at end of file