I’m only wrote this code in notepad++ and didn’t test it in my project,so now I can’t clearly said that it’s ok or not for me But if it is a good variant and there are no any exceptions,I think I will use it if the tests will be ok
Loaded my sketch to IDE but when I try to compile it there is an error:
exit status 1
Ошибка компиляции для платы NodeMCU 1.0 (ESP-12E Module).
@legionercheg post the latest version of your sketch and I’ll run it through the compiler for a NODEMCU clone.
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxx";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "yyy";
char pass[] = "zzz";
WidgetLED led1(V0);//стиралка gpio2
WidgetLED led2(V1);//ванная gpio0
WidgetLED led3(V2);//раковина gpio4
WidgetLED led4(V3);//связь с ардуино
SimpleTimer timer;
bool stiralka_notify;
bool vannaya_notify;
bool rakovina_notify;
bool arduino_notify;
bool stiralka_flag;
bool vannaya_flag;
bool rakovina_flag;
bool arduino_flag;
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
pinMode(15,INPUT);//стиралка
pinMode(5,INPUT);//ванная
pinMode(4,INPUT);//раковина
pinMode(16,INPUT);//вход от ардуино
pinMode(14,OUTPUT);//выход на ардуино
stiralka_flag=0;
vannaya_flag=0;
rakovina_flag=0;
arduino_flag=0;
timer.setInterval(15000L, Notify_all);//Notify_all будет срабатывать раз в 15 сек
}
void Notify_all()
{
if (stiralka_notify==1)
{
Blynk.email("стиралка","Датчик стиралки сработал!");
Blynk.notify("тревога!стиралка!");
}
else if (vannaya_notify==1)
{
Blynk.email("ванная","Датчик под ванной сработал!");
Blynk.notify("тревога!ванная!");
}
else if (rakovina_notify==1)
{
Blynk.email("раковина","Датчик под раковиной сработал!");
Blynk.notify("тревога!раковина!");
}
if (arduino_notify==1)
{
Blynk.email("ардуино","Связь с ардуино потеряна");
Blynk.notify("связь с ардуино потеряна");
}
else
{
Blynk.notify("связь с ардуино восстановлена");
}
}
void Led_stiralka()
{
if (digitalRead(15)==HIGH && stiralka_flag==0)
{
stiralka_notify=1;
stiralka_flag=1;
led1.on();
}
else if (digitalRead(15)==HIGH && stiralka_flag==1)
{
led1.on();
}
else
{
led1.off();
}
if (digitalRead(15)==LOW)
{
stiralka_flag=0;
led1.off();
}
}
void Led_vannayaa()
{
if (digitalRead(5)==HIGH && vannaya_flag==0)
{
vannaya_notify=1;
vannaya_flag=1;
led2.on();
}
else if (digitalRead(5)==HIGH && vannaya_flag==1)
{
led2.on();
}
else
{
led2.off();
}
if (digitalRead(5)==LOW)
{
vannaya_flag=0;
led2.off();
}
}
void Led_rakovina()
{
if (digitalRead(4)==HIGH && rakovina_flag==0)
{
rakovina_notify=1;
rakovina_flag=1;
led3.on();
}
else if (digitalRead(4)==HIGH && rakovina_flag==1)
{
led3.on();
}
else
{
led3.off();
}
if (digitalRead(4)==LOW)
{
rakovina_flag=0;
led3.off();
}
}
void Led_arduino()
{
if (digitalRead(16)==LOW && arduino_flag==0)
{
arduino_notify=1;
led4.off();
digitalWrite(14,LOW);
arduino_flag=1;
}
else if (digitalRead(16)==LOW && arduino_flag==1)
{
led4.off();
digitalWrite(14,LOW);
}
else if (digitalRead(16)==HIGH && arduino_flag==1)
{
led4.on();
digitalWrite(14,HIGH);
arduino_notify=0;
arduino_flag=0;
}
else
{
led4.on();
digitalWrite(14,HIGH);
}
}
@legionercheg no sketch will run without a loop().
It will compile when you add:
void loop()
{
Blynk.run();
timer.run();
}
The question is about Eventor widget:
When I set an event like this:
When some_virtual_pin V1 is equal to 1 send notification “Alarm”
it doesn’t work, but at this time LCD widget shows me that some_virtual_pin is “1”
But if I edit to this:
When some_virtual_pin V1 is higher than 0 send notification “Alarm”
All is OK. Maybe I write something in wrong sintax?
@Costas or @Eugene ,anyone may be you can answer me about the eventor syntax (in the Blynk app)?Oh maybe I did something wrong?
It could be our issue. Let me check.