As you can see, everything seems to be fine except the DHT. From what I have managed to decode from google, I think it needs a higher voltage? But I am not sure and don't want to fry my DHT22.
PS - (mynetworkname) is usually my network name, I just changed it for privacy and etc
Code:
#include <SimpleDHT.h>
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <Arduino_JSON.h>
#define DHTTYPE DHT22
char auth[] = "my auth code usually goes here";
char ssid[] = "My internet ssid is usually here";
char pass[] = "My internet password is usually here";
String data;
const int dht_pin = 2;
SimpleDHT22 dht22(dht_pin);
float humidity = 0;
float temperature = 0;
BlynkTimer timer;
void wait() {
Serial.println("delay");
}
void setup() {
Serial.begin(9600);
timer.setInterval(5000L, wait);
}
void loop() {
Blynk.begin(auth, ssid, pass);
Serial.println("Connecting.");
int err = SimpleDHTErrSuccess;
if((err = dht22.read2(&temperature, &humidity, NULL)) != SimpleDHTErrSuccess) {
Serial.print("ERROR: ");
Serial.println(err);
delay(2000);
return;
}
Blynk.virtualWrite(V5, float(humidity));
Blynk.virtualWrite(V6, float(temperature));
Serial.println(float(temperature));
Serial.println(float(humidity));
Blynk.run();
Serial.println("Sent data");
//ESP.deepSleep(600e6);
//ESP.deepSleep(1e6);
timer.run();
}
I don't actually get that output. I get a long string of unrecognised characters and question/exclamation marks and brackets that keeps on getting longer (not downwards, but right)
I also ran some examples from the default dht library, specifically DHT_ESP8266 and I get:
18:15:46.273 -> ⸮⸮⸮⸮⸮⸮
I tired unplugging the esp and plugging it in again and I get
18:17:22.051 -> ⸮⸮⸮,⸮1⸮⸮)!⸮⸮⸮
I am now running my code again to see if there is a problem with the board (which is. by the way, a NODEMCU ESP-12E)
And it has the same output as in my original post.
Now I am trying to run DHT22Integer example from SimpleDHT:
1⸮)!ь)!ь)⸮⸮⸮)!
More corruption
Now DHT22RawBits example:
18:21:52.756 -> ⸮⸮⸮⸮⸮0⸮1⸮⸮⸮⸮⸮
I am now trying installing the Simple DHT library from the arduino IDE library menu to the latest version, which shouldn't do much since I got the library from github literally this week.
Restarted Arduino IDE, unplugged and plugged back in esp, ran my code:
Right here is the situation straight:
After figuring out why the error messages were corrupted, fixing that, and then finding the right pin to plug the dht22 in, I finally got it work, and then for some reason it stopped working. So now it just prints error message 4880 and occasionally 5136. Here is a printout:
#include <SimpleDHT.h>
// for DHT22,
// VCC: 5V or 3V
// GND: GND
// DATA: 2
int pinDHT22 = 2;
SimpleDHT22 dht22(pinDHT22);
void setup() {
Serial.begin(115200);
}
void loop() {
// start working...
Serial.println("=================================");
Serial.println("Sample DHT22...");
// read without samples.
// @remark We use read2 to get a float data, such as 10.1*C
// if user doesn't care about the accurate data, use read to get a byte data, such as 10*C.
float temperature = 0;
float humidity = 0;
int err = SimpleDHTErrSuccess;
if ((err = dht22.read2(&temperature, &humidity, NULL)) != SimpleDHTErrSuccess) {
Serial.print("Read DHT22 failed, err="); Serial.println(err);delay(2000);
return;
}
Serial.print("Sample OK: ");
Serial.print((float)temperature); Serial.print(" *C, ");
Serial.print((float)humidity); Serial.println(" RH%");
// DHT22 sampling rate is 0.5HZ.
delay(2500);
}