Hi all, first time posting.
First project and I’ve been following along with a tutorial to get a DHT11 sensor reading temperature and humidity but I’ve hit a problem.
I’ve managed to get the code running, but the only readings I’m getting are Temp 0’C and Humidity 0%. The only possible problem I think I could possibly identify is the lack of a resistor or a faulty DHT11?
here is my set up:
(ScruffR: Removed irrelevant advertisement - please honor the forum rules. If you want to upload images just upload them directly here and not via “spamming” hosters)
Here is the code I’m running:
#include <Adafruit_DHT.h>
// DHT parameters
#define DHTPIN 5
#define DHTTYPE DHT11
// Variables
int temperature;
int humidity;
// DHT sensor
DHT dht(DHTPIN, DHTTYPE);
void setup() {
// Start DHT sensor
dht.begin();
}
void loop() {
// Humidity measurement
temperature = dht.getTempCelcius();
// Humidity measurement
humidity = dht.getHumidity();
// Publish data
Spark.publish("temperature", String(temperature) + " °C");
delay(2000);
Spark.publish("humidity", String(humidity) + "%");
delay(2000);
}
This is the tutorial I’ve been following:
any suggestions would be greatly appreciated as I feel totally out of my depth
Thanks
AC