I know this not an Blynk forum, but i really struggle with something i think has a simple solution. I have tried in Blynk forum, but the messages i get is cryptical.
So, what do i want?
I have an coffe maker that i will switch on and off with an Relay from my Blynk App. So far, so good. No problem at all. When i turn on the coffee maker from the app i will add an timer that makes the coffee maker turn off after 10 minutes automaticly if i turn it on. That part can i manage, and so far is all good.
But here is my problem:
When coffe maker shuts down after 10 minutes i want the button in the app to tell me the state (OFF). I just don't know where i stucked here. I have tried many things with no luck.
Here is my code. This code works and turns on/off the relay and gives me an 10 minutes shut off time. (it sat to 5 seconds for test purposes) Can someone in here help me to finally make the button feedback to work?
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
//Put WiFi cridentials and token here----------------------------------
char auth[] = "****";
char ssid[] = "****";
char pass[] = "****";
//---------------------------------------------------------------------
int coffeeSwitch = 5;
BlynkTimer timer;
void setup() {
Blynk.begin(auth, ssid, pass);
Serial.begin(9600);
pinMode(coffeeSwitch, OUTPUT);
digitalWrite(coffeeSwitch, HIGH);
//timer.setTimeout(5000L, timeOut);
}
BLYNK_CONNECTED() {
Blynk.syncAll();
}
void relayOff(){
digitalWrite(coffeeSwitch, HIGH);
}
BLYNK_WRITE(V1){
int pinValue = param.asInt();
digitalWrite(coffeeSwitch, pinValue);
if (pinValue == 1){
timer.setTimeout(5000, relayOff);
}
}
void loop() {
Blynk.run();
timer.run();
}