I have an Arduino Yun driving with a sketch for thermostat, controlling radiators and hot water production. The Blynk app is working fine, giving me a history graph of temperatures, sliders to set target temperatures, and leds, and a button to request hot water outside normal hours.
The main Arduino has a DHT22 sensor, as well as the output relays, but I want to use other EPS8266 devices (adafruit feather) to provide DHT22 data from other rooms and from outside.
I have used the Bridge example on the ESP8266 as follows:
/**************************************************************
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include “DHT.h”
#define DHTPIN 12 // what digital pin we’re connected to
#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321
DHT dht(DHTPIN, DHTTYPE, 30);
float humidity, temp_f; // Values read from sensor
SimpleTimer timer;
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth = “main auth”;
// Bridge widget on virtual V10
WidgetBridge bridge1(V10);
void HomeWork()
{
temp_f = dht.readTemperature(false)- 1.8;// Read temperature as Celsius
humidity = dht.readHumidity();bridge1.virtualWrite(V3,temp_f);
bridge1.virtualWrite(V13,humidity);
Blynk.virtualWrite(V3,temp_f);
Blynk.virtualWrite(V13,humidity);
Serial.println(temp_f);
Serial.println(humidity);
}
void setup()
{
Serial.begin(115200);
Blynk.begin(auth, “SSID”, “PWD”);
dht.begin();
timer.setInterval(10000, HomeWork);
while (Blynk.connect() == false) {
// Wait until connected
}
bridge1.setAuthToken(“…”);
}
void loop()
{
Blynk.run();
timer.run();
}
The above seems to be running fine, and I can see updates on a separate project app for the EPS8266. But I cannot see any updates on the master app.
Questions:
- Should I have a BLYNK_WRITE(V3) handler in the receiving sketch ? If yes, how to I take the value ? the param.asFloat() does not work.
- What is the virtual pin number - V10 - in the WidgetBridge bridge1(V10) for? Is it a way to identify the bridge on the sending sketch ?
Thanks.
LP