//[8] Interface an ESP32 with a Co2 gas sensor with appropriate connections. Continuously print
//the Co2 concentration using the serial terminal. If the Co2 concentration is above 75%, print
//“Alarm.
#define MQ135_PIN 34 // Analog pin
void setup() {
Serial.begin(115200);
}
void loop() {
int sensorValue = analogRead(MQ135_PIN); // 0–4095
float percent = (sensorValue / 4095.0) * 100;
Serial.print("CO2 Level: ");
Serial.print(percent);
Serial.println("%");
if (percent > 75) {
Serial.println("Alarm");
}
delay(2000);
}