HEY GUYS
I have a prblem with the BLYNK_WRITE( ) .
I’m using two esp nodemcu blynk based . one of them is creating the bridge between them . the other one is just checking the virtual pins and recieve orderfrom the first one .
when i used the BLYNK_WRITE( ) in the 2nd one (slave) it works . but when I use it in the (master) it doesn’t work
is there any issues in using the blynk bridge with the blynk write ?
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <DHT.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "c9940a7a1XXXXXXXXXXXXXXX";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "XXX";
char pass[] = "XXXX";
int pinData;
#define DHTPIN 4 // What digital pin we're connected to
#define DHTTYPE DHT11 // DHT 11
// #define DHTTYPE DHT22 // DHT 22, AM2302, AM2321
//#define DHTTYPE DHT21 // DHT 21, AM2301
DHT dht(DHTPIN, DHTTYPE);
SimpleTimer timer;
WidgetBridge bridge1(V1);
BLYNK_WRITE(V8)
{
pinData = param.asInt();
}
BLYNK_CONNECTED() {
// Place the AuthToken of the second hardware here
bridge1.setAuthToken("1e15f8dXXXXXXXXXXXXXXXX");
}
void sendSensor(){
// get readings from the DHT22 sensor
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;
}
Serial.print("recieved ");
Serial.print(pinData);
}
void setup(){
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
dht.begin();
timer.setInterval(500L, sendSensor);
}
void loop(){
Blynk.run();
timer.run();
}