//Project by Dani
//Topic - Industrial safety monitoring
#include <LiquidCrystal.h>
// Define the LCD pins
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
const int motionSensorPin = 6; // Digital pin for motion sensor
const int backlightPin = 7; // Digital pin for LCD backlight control
void setup() {
// Set up the LCD's number of columns and rows
lcd.begin(16, 2);
lcd.print("Project by Dani!");
delay(1000);
lcd.clear();
// Set up the backlight pin
pinMode(backlightPin, OUTPUT);
digitalWrite(backlightPin, HIGH); // Turn on the backlight
}
void loop() {
// Read sensor data
float temperature = readTemperature();
bool motionDetected = readMotionSensor();
// Display sensor data on LCD
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Temp: ");
lcd.print(temperature);
lcd.print(" C");
lcd.setCursor(0, 1);
lcd.print("Motion: ");
lcd.print(motionDetected ? "Detected" : "None");
delay(1000); // Delay for a second
}
float readTemperature() {
// Code to read temperature sensor
return 25.0; // Dummy value for demonstration
}
bool readMotionSensor() {
// Read motion sensor state
return digitalRead(motionSensorPin) == HIGH;
}