I have not read the data sheet regarding the warm up time but by feeling it i can tell it gets hot after five minutes. i also notice the readings dont jump around so much after it gets hot.
i want only the raw 1024 number not for early warning but to track throughout the day periodically, for example i want it to turn on, remain on for 6 minutes, turn off for 24 minutes continuously. i can from there see the values rise or fall for interest sake on my weather station.
i am going to try separate the two functions then, i will keep the raw reading one if i can find it, i only really understand excel this code is a whole other level.
Thank you very much your very helpful, especially about the long integer
Your problem is that you are using GPIO2 (personally Iād just reference it as 2 rather than A2 and that is an ADC2 pin, whic canāt be used at the same time as WiFi.
As a result, you need to use an ADC1 pin, which means one of the followingā¦
I have been trying the whole night, trying by changing and swapping around terms i think i know.
please could someone tell me where its wrong or how to fix it
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <DHT.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "2V85xWYJCdG7zCBuNatn9Z32SOu5THjB";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Home";
char pass[] = "H@1l3yB3@r21";
#define DHTPIN 4 // What digital pin we're connected to
#define V2 32
// Uncomment whatever type you're using!
#define DHTTYPE DHT11 // DHT 11
DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;
// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void sendSensor()
{
float h = dht.readHumidity();
float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
// You can send any value at any time.
// Please don't send more that 10 values per second.
Blynk.virtualWrite(V5, h);
Blynk.virtualWrite(V6, t);
Blynk.virtualWrite(V2, int);
}
void setup()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
dht.begin();
// Setup a function to be called every second
timer.setInterval(5000L, sendSensor);
}
void loop()
{
Blynk.run();
timer.run();
}
If you see some other tnan 0 as sensor reading at your serial monitor - the problem is in blynk.
Is you see 1000 at your appās gauge and 0 at your serial monitor- blynk is OK, the problem is in your hardware.
P.S. Is it a good idea to name your variable āintā? Definitely you should get error message when youāre trying to compile this piece of code.