merged display and buzzer files

comboLock
Jonas Wittstrøm 2 years ago
parent 82e379bff3
commit 46a4a8cfa1

@ -1,5 +0,0 @@
const int buzzerPin = 9;
void setup() {
pinMode(buzzerPin, OUTPUT_LOW);
}

@ -8,7 +8,7 @@ const char *password = "zwr33htm";
const char *mqtt_server = "192.168.24.215"; const char *mqtt_server = "192.168.24.215";
// set the LCD number of columns and rows const int buzzerPin = D0;
int lcdColumns = 16; int lcdColumns = 16;
int lcdRows = 2; int lcdRows = 2;
@ -18,13 +18,21 @@ LiquidCrystal_I2C lcd(0x3f, lcdColumns, lcdRows);
void setup(){ void setup(){
lcd.init(); lcd.init();
lcd.backlight(); lcd.backlight();
pinMode(buzzerPin, OUTPUT);
} }
void loop(){ void loop(){
// LCD
// set cursor to first column, first row // set cursor to first column, first row
lcd.setCursor(0, 0); lcd.setCursor(0, 0);
// print message // print message
lcd.print("Piss off, ghosts!"); lcd.print("Piss off, ghosts!");
// clears the display to print new message // clears the display to print new message
lcd.clear(); lcd.clear();
// buzzer
digitalWrite(buzzerPin, HIGH);
delay(1000);
digitalWrite(buzzerPin, LOW);
delay(1000);
} }
Loading…
Cancel
Save