Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define monitor_on 1
- #define monitor_off 0
- int monitor_stan = monitor_on; // wyłączanie seriala - np dla ESP01
- //====== predefinicje funkcji z innych bloków programu
- void pin1_rec(String value);
- void pin2_rec(String value);
- void pin3_rec(String value);
- void pin4_rec(String value);
- bool sendValue(const char* tag, String value);
- //======= deklaracje wartości początkowych
- int pin0_lastValue = 0;
- int pin6_lastValue = 0;
- int pin7_lastValue = 0;
- int pin8_lastValue = 0;
- // deklaracje pinów łączących ESP i APP
- // V0 do V9 app --> esp,
- const char* pin0 = "V0"; // tag for digital input
- const char* pin1 = "V1"; // tag for digital input
- const char* pin2 = "V2"; // tag for digital input
- const char* pin3 = "V3"; // tag for digital input
- const char* pin4 = "V4"; // tag for digital o
- const char* pin5 = "V5"; // tag for digital input
- const char* pin6 = "V6"; // tag for output
- const char* pin7 = "V7"; //tag for output
- const char* pin8 = "V8"; // tag for output
- const char* pin11 = "V11"; // tag for output
- const char* pin12 = "V12"; // tag for output
- //===================================================== sendPinStatus
- // It is called every time a new client is connected.
- // The void informs Virtuino app about the current pin states and variable values.
- void sendPinsStatus() {
- sendValue(pin0, String(pin0_lastValue));
- sendValue(pin6, String(pin6_lastValue));
- sendValue(pin7, String(pin7_lastValue));
- sendValue(pin8, String(pin8_lastValue));
- }
- //===================================================== onValueReceived
- // It is called every time a new value received - add ---> esp
- void onValueReceived(String tag, String value) {
- if (monitor_stan = monitor_on) Serial.println("Received: tag=" + tag + " value=" + value);
- if (tag == "V1") pin1_rec(value);
- if (tag == "V2") pin2_rec(value);
- if (tag == "V3") pin3_rec(value);
- if (tag == "V4") pin4_rec(value);
- }
Advertisement
Add Comment
Please, Sign In to add comment