#define BLYNK_TEMPLATE_ID "JHBKBFDS"
#define BLYNK_DEVICE_NAME "KJBSDKFJBSDF"
#define BLYNK_FIRMWARE_VERSION "0.1.0"
#define BLYNK_PRINT Serial
//#define BLYNK_DEBUG
#define APP_DEBUG
#include "BlynkEdgent.h"
#include <DHT.h>
#include <SPI.h>
#define DHTPIN 1
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;
BLYNK_CONNECTED() {
Blynk.syncAll(); }
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(V1, h); //V1 is for Humidity
Blynk.virtualWrite(V2, t); //V2 is for Temperature
}
void setup()
{
Serial.begin(115200);
delay(100);
BlynkEdgent.begin();
dht.begin();
timer.setInterval(10000L, sendSensor);
}
void loop() {
BlynkEdgent.run();
timer.run();
}
and another error now:
C:\Users\*****\Documents\Arduino\Blynk_Edgent_ESP8266_3dp_new\Blynk_Edgent_ESP8266_3dp_new.ino: In function 'void setup()':
Blynk_Edgent_ESP8266_3dp_new:45:3: error: '' was not declared in this scope
45 | BlynkEdgent.begin();
|
C:\Users\******\Documents\Arduino\Blynk_Edgent_ESP8266_3dp_new\Blynk_Edgent_ESP8266_3dp_new.ino: In function 'void loop()':
Blynk_Edgent_ESP8266_3dp_new:51:15: error: 'class Edgent' has no member named 'run'
51 | BlynkEdgent.run();
| ^~~
exit status 1
'' was not declared in this scope
i need to add DHT temperature sensor. Is there already included SPI in this firmware? also, if that possible to define pins for DHT sensor from web interface, or i need to do that in sketch?
thanks all for help. but still got couple questions. sorry
seems, device remember last state before it powered down… while at this offline time - switch state changed. so when it back online - it got prev state of switch. how to do all switches sync, when device is going powered? BLYNK_CONNECTED() { Blynk.syncAll(); } not helped me at all… there no option, for switches, to sync - in web dashboard editor…
Yes, you told me that already. But there no such option for switches. Only for digit values, in my case. Switches either in datastream tab… I need so switches sync too. There was, such option, in old code…
From the screen in your screenshot, click the EDIT button, then click on one of the datastreams that you want to be synchronised by the Blynk.syncAll() command.
At the bottom of the pop-up dialogue box click the “+ Advanced Settings” option.
Post a screenshot of what you see - or simply re-read this for the third time, and make the necessary change…
Why not digital? Or digital can’t be sync, as I need? Kinda silly, that this can’t be sync… Is supposed to be handy in every way, on my opinion. Anyway, thanks. I think it’s all for now.
btw, i wanted to say to you -
you forgetting to add to some code, like {} (in this quoted linked messages), and in first message you told, in new code, changed to Edgent.begin();, but its BlynkEdgent.begin();. just for your to notice. you helped me, anyway.
its just, that people could copy paste this code and will get errors, so they will open new threads, etc.