I started working with blynk & my Nodemcu.
I’m setting different mode for controlling Fan from Menu like mannual control, time control, temperature & PIR mode.
Now i’m stuck in mannual mode at th beginning.
This is my code.
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "some token";
char ssid[] = "My_ssid";
char pass[] = "My_pass";
char server[] = "my_Localserver";
int ms1;
void setup()
{
pinMode(D0,OUTPUT);
Blynk.begin(auth, ssid, pass, server);
}
BLYNK_WRITE(V0) {
switch (param.asInt())
{
case 1: // Mannual Switch
if (ms1==1)
{
digitalWrite(D0,HIGH);
}
else
{
digitalWrite(D0,LOW);
}
case 2: // Time Controlled Switch
break;
case 3: // Temperature Controlled Automated
break;
case 4: // PIR Controlled Automated
break;
default:
break;
}
}
BLYNK_WRITE(V1) //When Mannual Mode enabled, this switched is used
{
int ms1 = param.asInt();
}
BLYNK_WRITE(V2) //For Time controlled switch
{
TimeInputParam t(param);
if (t.hasStartTime())
{
}
else
{
}
if (t.hasStopTime())
{
}
else
{
}
}
void loop()
{
Blynk.run();
}
I have set a menu on app with output to V0.
Switch output is V1.
When i select Mannual mode in menu & trying to change state of switch, nothing happening to D0.
But i can directly change state of D0 if i use output of switch to D0
Where am i doing wrong