Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wire.h>
- #include <LiquidCrystal_I2C.h>
- LiquidCrystal_I2C lcd(0x27, 16, 2);
- int buz = 11;
- int d = 0;
- void setup()
- {
- pinMode(buz, OUTPUT);
- Serial.begin(9600);
- lcd.init();
- lcd.init();
- lcd.backlight();
- lcd.setCursor(1, 0);
- lcd.print("Hello, world!");
- delay(5000);
- lcd.clear();
- }
- void loop()
- {
- d = Serial.read();
- if (d == 'p' )
- {
- lcd.setCursor(0, 0);
- lcd.print("Status:");
- lcd.setCursor(0, 1);
- lcd.print("Fire Detected");
- digitalWrite(buz, 1);
- delay(800);
- }
- if (d == 's' )
- {
- lcd.setCursor(0, 0);
- lcd.print("Status:");
- lcd.setCursor(0, 1);
- lcd.print(" Safe ");
- digitalWrite(buz, 0);
- delay(5);
- }
- }
Add Comment
Please, Sign In to add comment