Advertisement
krzysp

virtuino IoT base unit pins unit

Jan 5th, 2023
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Arduino 1.17 KB | Source Code | 0 0
  1. #define monitor_on 1
  2. #define monitor_off 0
  3. int monitor_stan = monitor_on;  // wyłączanie seriala - np dla ESP01
  4.  
  5. //====== predefinicje funkcji z innych bloków programu
  6. void pin0_rec(String value);
  7. bool sendValue(const char* tag, String value);
  8.  
  9. //======= deklaracje wartości początkowych
  10. int pin11_lastValue = 0;
  11.  
  12. // deklaracje pinów łączących ESP i APP  
  13. const char* pin0 = "V0";            
  14. const char* pin10 = "V10";    
  15. const char* pin11 = "V11";    
  16. const char* pin12 = "V12";  
  17.  
  18. //===================================================== sendPinStatus
  19. // It is called every time a new client is connected.
  20. // The void informs Virtuino app about the current pin states and variable values.
  21.  
  22. void sendPinsStatus() {
  23.   sendValue(pin11, String(pin11_lastValue));    // send pin11 value
  24.  
  25.   // add more here...
  26. }
  27.  
  28. //===================================================== onValueReceived
  29. // It is called every time a new value received  - add ---> esp
  30. void onValueReceived(String tag, String value) {
  31.  if (monitor_stan == monitor_on)  Serial.println("Received: tag=" + tag + "  value=" + value);
  32.   if (tag == "V0") pin0_rec(value);
  33.  
  34.    // add more here...
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement