Hi There,
I’m having issue with some code that was working previously, (although relay wouldn’t reset) wondering if anyone could solve this easily, I’m a bit new to Arduino & Thinger. I’m not getting any errors with the code however the relay is not activating at all when temp is out of range, any ideas appreciated
Code:
#include <DHT.h>
#include <SPI.h>
#include <Ethernet.h>
#include <ThingerEthernet.h>
// dht config
#define DHTPIN 7
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
int relay = 8;
// thinger.io config
ThingerEthernet thing(“haggis77”, “Arduino”, “minibeast123”);
void setup() {
dht.begin();
pinMode(relay, OUTPUT); //sets pin8 as relay output
thing[“DHT11 Readout”] >> [](pson& out){
out[“Humidity”] = dht.readHumidity();
out[“Temperature”] = dht.readTemperature();
};
void loop() {
thing.handle();
if(“Temperature” > 31, relay, HIGH);
if(“Temperature” < 16, relay, HIGH);
//Sets off relay if Temperature is out of range
delay (8000);
digitalWrite(relay, LOW);
}