The Code
There were a lot of draft codes, like a lot, which is why these are the finalized code. Who wants to see broken code?
int buzzer = 9;
int co_sensor = 8;
int co_detected;
int msr = 0;
int sensor = A0;
int LED = 4;
#include <LiquidCrystal.h>
LiquidCrystal lcd (12, 11, 5, 4, 3, 2);
#include <dht.h>
dht DHT;
#define DHT11_PIN 7
void setup() {
int ts = DHT.readTemperature
int hs = DHT.readHumidity
lcd.begin(16,2);
Serial.begin(9600);
pinMode(4, OUTPUT);
pinMode(buzzer, OUTPUT);
pinMode(co_sensor, INPUT);
}
void loop() {
int chk = DHT.read11(DHT11_PIN);
lcd.setCursor(0,0);
lcd.print("Temp-");
lcd.print(ts);
lcd.print("c");
lcd.setCursor(0,1);
lcd.print("Humidity-");
lcd.print(hs);
lcd.print("%");
Serial.print
co_detected = digitalRead(co_sensor);
if(co_detected == LOW) {
Serial.println("co detected... run for your life!");
digitalWrite(buzzer, HIGH);
}
else {
Serial.println("no co detected... go eat some pizza");
digitalWrite(buzzer, LOW);
}
msr = analogRead(sensor);
Serial.println(msr);
if (msr > 100) {
Serial.println("soft light");
digitalWrite(4, LOW);
}
else {
Serial.println("hard light");
digitalWrite(4, HIGH);
}
delay(1000);
}
The Finalized code


No comments to display
No comments to display