#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
#define red 13
#define green 10
#define buzzer 9
#define przycisk 8
#define detection 7
int czas;
void setup() {
pinMode(detection, INPUT_PULLUP);
pinMode(przycisk, INPUT_PULLUP);
pinMode(red, OUTPUT);
pinMode(green, OUTPUT);
pinMode(buzzer, OUTPUT);
lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print("Program testowy");
lcd.setCursor(0, 1);
lcd.print("by Sztrefan");
delay(2000);
lcd.clear();
}
void loop() {
if (detection == LOW)
{
digitalWrite(red, LOW);
digitalWrite(red, HIGH);
if (przycisk == HIGH) ;
lcd.setCursor(0, 0);
lcd.print("Wyciszono alarm");
lcd.setCursor(0 ,1);
lcd.print("na 1 minute.");
delay(60000);
}
else if (przycisk == LOW) {
lcd.setCursor(0, 0);
lcd.print("ALARM !!!");
lcd.setCursor(0, 1);
lcd.print("BRAK PRADU !!!");
for(int x = 0; x < 1000; x++) {
digitalWrite(buzzer, HIGH);
digitalWrite(red, HIGH);
delay(500);
digitalWrite(buzzer, LOW);
digitalWrite(red, LOW);
}
}
}
else if (detection == HIGH) {
lcd.setCursor(0, 0);
lcd.print("Prad jest w");
lcd.setCursor(0 ,1);
lcd.print("kontakcie");
for(int y = 0; y < 1000; y++) {
digitalWrite(green, HIGH);
delay(500);
digitalWrite(green, LOW);
}
digitalWrite(red, LOW);
}
}
Cały kod
Tekst na czerwono to linia w ktorej mi wyskauje błąd.