I would very much appreciate it if anyone would like to help me combine all of these codes.
#include <LiquidCrystal.h>
LiquidCrystal lcd (12, 11, 5, 4, 3, 2);
int flame_sensor = A3;
int flame_detected;
const int buzzer = 13;
void setup() {
pinMode(flame_sensor, INPUT);
pinMode(buzzer, OUTPUT);
}
void loop() {
// Flame sensor
flame_detected = digitalRead(flame_sensor);
if (flame_detected == 1)
{
lcd.println("Flame detected");
tone(buzzer, 500);
delay(5000);
}
else
{
lcd.println("No flame detected");
tone(buzzer, 500);
}
delay(5000);
}
const int buzzer = 13;
int shakesensor = A0;
void setup()
{
Serial.begin(9600);
pinMode(buzzer, OUTPUT);
}
void loop()
{
// Shake sensor
shakesensor = analogRead(A0);
if (shakesensor<1022){
tone(buzzer, 500);
Serial.print("shakesensor Value: ");
Serial.println(shakesensor);
}
else{
noTone(buzzer);
Serial.print("shakesensor Value: ");
Serial.println(shakesensor);
}
delay(100);
}
#include <LiquidCrystal.h>
LiquidCrystal lcd (12, 11, 5, 4, 3, 2);
int gassensor = A2;
int ThreshHold = 60;
const int buzzer = 13;
void setup() {
Serial.begin(9600);
lcd.begin (16, 2);
pinMode(gassensor, INPUT);
}
void loop() {
//Gas sensor
int SensorState = analogRead (gassensor);
int analogValue = SensorState;
Serial.println(analogValue);
if (analogValue > ThreshHold){
tone(buzzer, 500);
lcd.clear();
lcd.print("Gas detected");
delay(5000);
}
else {
lcd.clear();
lcd.print("No gas detected");
delay(5000);
}
lcd.clear();
}
#include <LiquidCrystal.h>
int temperaturesensor = A1;
float temp;
float tempc;
float tempf;
LiquidCrystal lcd (12, 11, 5, 4, 3, 2);
void setup() {
Serial.begin(9600);
lcd.begin (16, 2);
}
void loop() {
// Temperature sensor
temp=analogRead(temperaturesensor);
tempc=(temp*4.88)/10;
tempf=(tempc*1.8)+32;
lcd.setCursor(0,0);
lcd.print("Temp in C = ");
lcd.println(tempc);
lcd.setCursor(0,1);
lcd.print("Temp in F = ");
lcd.println(tempf);
delay(5000);
}