I have added a variable x that is reading virtual pin 0 from the datastream. I am able to see the integer change in the serial monitor, but its not changing in my code. I am simply subtracting the x from the temp, but it doesnt seem to be working.
Thanks in advance
#define BLYNK_FIRMWARE_VERSION "0.0.5"
#define BLYNK_TEMPLATE_ID "TMPLvQM2iWfK"
#define BLYNK_DEVICE_NAME "House Automation"
#define BLYNK_AUTH_TOKEN "V9DD9TcsN-CXuqlMSgDXJVxRgEkizT8-"
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include "DHT.h"
#define DHTPIN 5
#define DHTTYPE DHT22
int x;
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "cait&caiden";
char pass[] = "Kinghenry3";
DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;
BLYNK_WRITE(V0)
{
x = param.asInt();
Serial.print("V0 value is: ");
Serial.println(x);
}
void temp(){
float h = dht.readHumidity();
float t = dht.readTemperature(true);
Blynk.virtualWrite(V7, h);
Blynk.virtualWrite(V8, (t-x));
}
void setup(){
Serial.begin(115200);
dht.begin();
Blynk.begin(auth, ssid, pass);
timer.setInterval(10000L, temp);
}
void loop(){
Blynk.run();
timer.run();
}