Hello, I want to implement MQ135 sensor to my program and am having a lot of problems. Can anyone help me?
Regards.
#include <SPI.h>
#include <Ethernet.h>
#include <ThingerEthernet.h>
#include “DHT.h”
// dht config
#define DHTPIN 2
#define VENTPIN 3
#define DHTTYPE DHT11
#define RELAY_2 4
#define led 5
DHT dht(DHTPIN, DHTTYPE);
// thinger.io config
ThingerEthernet thing(“111111111”, “1111111”, “11111111”);
void setup() {
dht.begin();
thing[“dht11”] >> [](pson& out){
out[“humidity”] = dht.readHumidity();
out[“celsius”] = dht.readTemperature();
out[“fahrenheit”] = dht.readTemperature(true);
};
pinMode(RELAY_2, OUTPUT);
thing[“relay_2”] << [](pson& in){
thing[“relay_2”] << digitalPin(4);
};
pinMode(led, OUTPUT);
thing[“led”] << [](pson& in){
thing[“led”] << digitalPin(5);
};
};
void loop() {
thing.handle();
if (dht.readTemperature() >= 28){
digitalWrite(VENTPIN, HIGH);
}
else {
digitalWrite(VENTPIN, LOW);
}
}