Before creating the topic
- Search forum for similar topics
I tried the BlynkTimer did not worked and also i tried without any timesrs or delays, still same issue - Check http://docs.blynk.cc and http://help.blynk.cc/
- Add details :
• Hardware model + communication type. NodeMCU v3 - wifi
• Smartphone OS (iOS or Android) + version: Latest android version
• Blynk server or local server - Local server
• Blynk Library version 0.6.1
• Add your sketch code.
#define BLYNK_PRINT Serial
#include "DHT.h" // DHT Sensor
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "";
char ssid[] = "";
char pass[] = "";
#define SensorPin A0
IPAddress local_IP(192, 168, 88, 8);
IPAddress gateway(192, 168, 88, 1);
IPAddress subnet(255, 255, 255, 0);
IPAddress primaryDNS(8, 8, 8, 8);
IPAddress secondaryDNS(8, 8, 4, 4);
DHT dht(5, DHT21);
BlynkTimer timer;
void notifySoil(float prt, String type)
{
if (prt < 52.00 && type == "soil") {
Blynk.notify("Alert Soil Hum low: " + String(prt) + "%");
};
if (prt > 27.00 && type == "temp") {
Blynk.notify("Alert Temp high: " + String(prt) + "C");
};
if (prt < 21.00 && type == "temp") {
Blynk.notify("Alert Temp low: " + String(prt) + "C");
};
}
void climateRoutine() {
int dryValue = 1023;
int wetValue = 0;
int friendlyDryValue = 0;
int friendlyWetValue = 100;
float percentage = 0.0;
byte h1 = dht.readHumidity();
byte t1 = dht.readTemperature();
float sensorValue = analogRead(SensorPin);
percentage = map(sensorValue, dryValue, wetValue, friendlyDryValue, friendlyWetValue);
Blynk.virtualWrite(V0, t1);
Blynk.virtualWrite(V1, h1);
Blynk.virtualWrite(V2, percentage);
notifySoil(percentage, "soil");
notifySoil(t1, "temp");
Serial.println(t1);
}
void setup() {
Serial.begin(9600);
if (!WiFi.config(local_IP, gateway, subnet, primaryDNS, secondaryDNS)) {
Serial.println("STA Failed to configure");
};
Blynk.begin(auth, ssid, pass, IPAddress(192,168,88,7), 8080);
dht.begin();
timer.setInterval(40000L, climateRoutine);
}
void loop() {
Blynk.run();
timer.run();
}
Initially i was using the public server, and then i moved to a local one, I thought maybe my devboard would make to many requests or something adn I wanted to see the logs.
Did not found anything relevant in the logs.
Then i found some forum posts about not using delay in the code, so i tried using BlynkTimer, but same issues persisted.
Then i eliminated all trimmers or delays and still the same issue.
Can’t find anything else on the forum or google…
I am new to c and maybe i am doing something wroang in the code, idk…