├── E00_ESP_Helloworld_NewWiFiManager.ino ├── E00_ESP_Helloworld_WiFiManager.ino ├── E01_ESP_DHT11.ino ├── E02_ESP_Dallas.ino ├── E03_ESP_LDR.ino ├── E04_ESP_PWM.ino ├── E05_ESP_BMP180.ino ├── E06_ATTINY_EMONLIB.ino ├── E06_ESP_EMONLIB.ino ├── E07_PIR_with_LDR.ino ├── E08_ESP_Capacitive_Sensor.ino ├── E09-Dynamic_Typicals.ino ├── ESPmaster_ArduinoSlave ├── ArduinoSlave │ └── ArduinoSlave.ino └── ESPmaster │ └── ESPmaster.ino ├── README.md ├── SoulissDomo_Device_Example ├── SoulissESP_e02_WebConfiguration │ └── SoulissESP_e02_WebConfiguration.ino ├── Souliss_ESP_WebInterface_Simplified │ ├── PAGE_NetworkConfiguration.h │ ├── Page_Admin.h │ ├── Page_Root.h │ ├── Page_Script.js.h │ ├── Page_Style.css.h │ ├── Souliss_ESP_WebInterface_Simplified.ino │ ├── global.h │ ├── helpers.h │ └── main.h ├── Souliss_ESP_v4 │ ├── Functions.h │ ├── Page_General.h │ ├── PinsConfig.h │ ├── SetupAndLoop.h │ ├── Souliss_ESP_v4.cpp.generic.bin │ ├── Souliss_ESP_v4.ino │ ├── Souliss_ESP_v4.zip │ ├── Souliss_ESP_v4_rev2_dht22.cpp.generic.bin │ ├── irButtons.h │ └── irReceiver.h └── Souliss_ESPv3_5 │ ├── Functions.h │ ├── PAGE_NetworkConfiguration.h │ ├── Page_Admin.h │ ├── Page_General.h │ ├── Page_Information.h │ ├── Page_NTPSettings.h │ ├── Page_Root.h │ ├── Page_Script.js.h │ ├── Page_Style.css.h │ ├── Souliss_ESPv3_5.ino │ ├── example.h │ ├── global.h │ ├── helpers.h │ └── main.h ├── Souliss_Tutorial_Español.md ├── TODO.md └── images ├── Imagenes Tutorial Appsi ├── Screenshot_2015-11-22-19-34-32.png ├── Screenshot_2015-11-23-16-17-21.png ├── Screenshot_2015-11-23-16-18-26.png ├── Screenshot_2015-11-23-16-18-50.png ├── Screenshot_2015-11-23-16-19-03.png ├── Screenshot_2015-11-23-16-19-19.png ├── Screenshot_2015-11-23-16-19-25.png ├── Screenshot_2015-11-23-16-19-39.png ├── Screenshot_2015-11-23-16-19-46.png ├── Screenshot_2015-11-23-16-20-28.png ├── Screenshot_2015-11-23-16-20-34.png ├── Screenshot_2015-11-23-16-20-45.png ├── Screenshot_2015-11-23-16-34-27.png ├── Screenshot_2015-11-23-16-36-25.png ├── Screenshot_2015-11-23-16-36-31.png ├── Screenshot_2015-11-23-16-36-45.png ├── Screenshot_2015-11-23-16-37-03.png ├── Screenshot_2015-11-23-16-37-09.png ├── Screenshot_2015-11-23-16-38-07.png ├── Screenshot_2015-11-23-16-39-08.png ├── Screenshot_2015-11-23-16-39-47.png └── Screenshot_2015-11-23-16-40-27.png └── detail /E00_ESP_Helloworld_NewWiFiManager.ino: -------------------------------------------------------------------------------- 1 | 2 | /************************************************************************* 3 | Souliss - Hello World for Expressif ESP8266 with new SSID Manager, no EEPROM needed. 4 | 5 | Note: TODO. Add details. Open 192.168.4.1 6 | 7 | This is the basic example, create a software push-button on Android 8 | using SoulissApp (get it from Play Store). 9 | 10 | Load this code on ESP8266 board using the porting of the Arduino core 11 | for this platform. 12 | 13 | ***************************************************************************/ 14 | #include 15 | #include 16 | #include 17 | 18 | enum { 19 | APPLICATION_WEBSERVER = 0, 20 | ACCESS_POINT_WEBSERVER 21 | }; 22 | 23 | MDNSResponder mdns; 24 | ESP8266WebServer server(80); 25 | const char* ssid = "esp8266e"; // Use this as the ssid as well 26 | // as the mDNS name 27 | const char* passphrase = "esp8266e"; 28 | String st; 29 | String content; 30 | 31 | boolean start; 32 | 33 | #define MaCaco_DEBUG_INSKETCH 34 | #define MaCaco_DEBUG 1 35 | 36 | #define VNET_DEBUG_INSKETCH 37 | #define VNET_DEBUG 1 38 | 39 | // Configure the framework 40 | #include "bconf/MCU_ESP8266.h" // Load the code directly on the ESP8266 41 | #include "conf/Gateway.h" // The main node is the Gateway, we have just one node 42 | #include "conf/IPBroadcast.h" 43 | 44 | // Include framework code and libraries 45 | #include 46 | #include "Souliss.h" 47 | 48 | // This identify the number of the LED logic 49 | #define MYLEDLOGIC 0 50 | 51 | // **** Define here the right pin for your ESP module **** 52 | #define OUTPUTPIN 15 53 | 54 | 55 | void setup() 56 | { 57 | Serial.begin(115200); 58 | start = setup_esp(); 59 | if(start) Serial.print("TRUE"); else Serial.print("FALSE"); 60 | 61 | if(start){ 62 | Initialize(); 63 | 64 | // Connect to the WiFi network and get an address from DHCP 65 | GetIPAddress(); 66 | SetAsGateway(myvNet_dhcp); // Set this node as gateway for SoulissApp 67 | 68 | // This is the vNet address for this node, used to communicate with other 69 | // nodes in your Souliss network 70 | SetAddress(0xAB01, 0xFF00, 0x0000); 71 | SetAsPeerNode(0xAB02, 1); 72 | 73 | Set_DimmableLight(MYLEDLOGIC); // Define a simple LED light logic 74 | 75 | pinMode(OUTPUTPIN, OUTPUT); // Use pin as output 76 | } 77 | } 78 | 79 | void loop() 80 | { 81 | if (!start) { 82 | server.handleClient(); // In this example we're not doing too much 83 | } 84 | else 85 | { 86 | // Here we start to play 87 | EXECUTEFAST() { 88 | UPDATEFAST(); 89 | 90 | FAST_50ms() { // We process the logic and relevant input and output every 50 milliseconds 91 | 92 | Logic_DimmableLight(MYLEDLOGIC); 93 | analogWrite(OUTPUTPIN, mOutput(MYLEDLOGIC+1)*4); 94 | } 95 | 96 | // Here we handle here the communication with Android 97 | FAST_GatewayComms(); 98 | } 99 | 100 | } 101 | } 102 | 103 | /************************************************************************************************/ 104 | /********************************** FUNCTIONS *****************************/ 105 | 106 | bool setup_esp() { 107 | 108 | WiFi.mode(WIFI_STA); // Assume we've already been configured 109 | // Serial.setDebugOutput(true); 110 | // WiFi.printDiag(Serial); 111 | if (testWifi()) { 112 | setupApplication(); // WiFi established, setup application 113 | return 1; 114 | } else { 115 | setupAccessPoint(); // No WiFi yet, enter configuration mode 116 | return 0; 117 | } 118 | 119 | } 120 | 121 | bool testWifi(void) { 122 | int c = 0; 123 | Serial.println("\nWaiting for Wifi to connect..."); 124 | while ( c < 20 ) { 125 | if (WiFi.status() == WL_CONNECTED) { 126 | return true; 127 | } 128 | delay(500); 129 | Serial.print(WiFi.status()); 130 | c++; 131 | } 132 | Serial.println("\nConnect timed out, opening AP"); 133 | return false; 134 | } 135 | 136 | void setupApplication() { 137 | if (mdns.begin(ssid, WiFi.localIP())) { 138 | Serial.println("\nMDNS responder started"); 139 | } 140 | launchWeb(APPLICATION_WEBSERVER); // In this example just launch a 141 | // web server 142 | } 143 | 144 | void setupAccessPoint(void) { 145 | WiFi.mode(WIFI_STA); 146 | WiFi.disconnect(); 147 | delay(100); 148 | int n = WiFi.scanNetworks(); 149 | Serial.println("scan done"); 150 | if (n == 0) 151 | Serial.println("no networks found"); 152 | else 153 | { 154 | Serial.print(n); 155 | Serial.println(" networks found"); 156 | for (int i = 0; i < n; ++i) 157 | { 158 | // Print SSID and RSSI for each network found 159 | Serial.print(i + 1); 160 | Serial.print(": "); 161 | Serial.print(WiFi.SSID(i)); 162 | Serial.print(" ("); 163 | Serial.print(WiFi.RSSI(i)); 164 | Serial.print(")"); 165 | Serial.println((WiFi.encryptionType(i) == ENC_TYPE_NONE) ? " " : "*"); 166 | delay(10); 167 | } 168 | } 169 | Serial.println(""); 170 | st = "
    "; 171 | for (int i = 0; i < n; ++i) 172 | { 173 | // Print SSID and RSSI for each network found 174 | st += "
  1. "; 175 | st += WiFi.SSID(i); 176 | st += " ("; 177 | st += WiFi.RSSI(i); 178 | st += ")"; 179 | st += (WiFi.encryptionType(i) == ENC_TYPE_NONE) ? " " : "*"; 180 | st += "
  2. "; 181 | } 182 | st += "
"; 183 | delay(100); 184 | WiFi.mode(WIFI_AP); 185 | WiFi.softAP(ssid, passphrase, 6); 186 | launchWeb(ACCESS_POINT_WEBSERVER); 187 | } 188 | 189 | void launchWeb(int webservertype) { 190 | Serial.println("\nWiFi connected"); 191 | Serial.print("Local IP: "); 192 | Serial.println(WiFi.localIP()); 193 | Serial.print("SoftAP IP: "); 194 | Serial.println(WiFi.softAPIP()); 195 | setupWebServerHandlers(webservertype); 196 | // Start the server 197 | server.begin(); 198 | Serial.print("Server type "); 199 | Serial.print(webservertype); 200 | Serial.println(" started"); 201 | // WiFi.printDiag(Serial); 202 | } 203 | 204 | void setupWebServerHandlers(int webservertype) 205 | { 206 | if ( webservertype == ACCESS_POINT_WEBSERVER ) { 207 | server.on("/", handleDisplayAccessPoints); 208 | server.on("/setap", handleSetAccessPoint); 209 | server.onNotFound(handleNotFound); 210 | } else if (webservertype == APPLICATION_WEBSERVER) { 211 | server.on("/", handleRoot); 212 | server.on("/setap", handleAccessPointAlreadySet); 213 | server.onNotFound(handleNotFound); 214 | } 215 | } 216 | 217 | void handleDisplayAccessPoints() { 218 | IPAddress ip = WiFi.softAPIP(); 219 | String ipStr = String(ip[0]) + '.' + String(ip[1]) + '.' + String(ip[2]) + '.' + String(ip[3]); 220 | uint8_t mac[6]; 221 | WiFi.macAddress(mac); 222 | String macStr = macToStr(mac); 223 | content = "\nHello from "; 224 | content += ssid; 225 | content += " at "; 226 | content += ipStr; 227 | content += " ("; 228 | content += macStr; 229 | content += ")"; 230 | content += "

"; 231 | content += st; 232 | content += "

"; 233 | content += "
"; 234 | content += "

We will attempt to connect to the selected AP and reset if successful."; 235 | content += "

Wait a bit and try connecting to http://"; 236 | content += ssid; 237 | content += ".local"; 238 | content += ""; 239 | server.send(200, "text/html", content); 240 | } 241 | 242 | void handleSetAccessPoint() { 243 | int httpstatus = 200; 244 | String qsid = server.arg("ssid"); 245 | String qpass = server.arg("pass"); 246 | if (qsid.length() > 0 && qpass.length() > 0) { 247 | for (int i = 0; i < qsid.length(); i++) 248 | { 249 | // Deal with (potentially) plus-encoded ssid 250 | qsid[i] = (qsid[i] == '+' ? ' ' : qsid[i]); 251 | } 252 | for (int i = 0; i < qpass.length(); i++) 253 | { 254 | // Deal with (potentially) plus-encoded password 255 | qpass[i] = (qpass[i] == '+' ? ' ' : qpass[i]); 256 | } 257 | WiFi.mode(WIFI_AP_STA); 258 | WiFi.begin(qsid.c_str(), qpass.c_str()); 259 | if (testWifi()) { 260 | Serial.println("\nGreat Success!"); 261 | delay(3000); 262 | abort(); 263 | } 264 | content = "\n"; 265 | content += "Failed to connect to AP "; 266 | content += qsid; 267 | content += ", try again."; 268 | } else { 269 | content = ""; 270 | content += "Error, no ssid or password set?"; 271 | Serial.println("Sending 404"); 272 | httpstatus = 404; 273 | } 274 | server.send(httpstatus, "text/html", content); 275 | } 276 | 277 | void handleRoot() { 278 | IPAddress ip = WiFi.localIP(); 279 | String ipStr = String(ip[0]) + '.' + String(ip[1]) + '.' + String(ip[2]) + '.' + String(ip[3]); 280 | uint8_t mac[6]; 281 | WiFi.macAddress(mac); 282 | String macStr = macToStr(mac); 283 | content = "\nHello from "; 284 | content += ssid; 285 | content += " at "; 286 | content += ipStr; 287 | content += " ("; 288 | content += macStr; 289 | content += ")"; 290 | content += ""; 291 | server.send(200, "text/html", content); 292 | } 293 | 294 | void handleAccessPointAlreadySet() { 295 | content = "\n"; 296 | content += "You already set up the access point and it is working if you got this far."; 297 | content += ""; 298 | server.send(200, "text/html", content); 299 | } 300 | 301 | void handleNotFound() { 302 | content = "File Not Found\n\n"; 303 | content += "URI: "; 304 | content += server.uri(); 305 | content += "\nMethod: "; 306 | content += (server.method() == HTTP_GET) ? "GET" : "POST"; 307 | content += "\nArguments: "; 308 | content += server.args(); 309 | content += "\n"; 310 | for (uint8_t i = 0; i < server.args(); i++) { 311 | content += " " + server.argName(i) + ": " + server.arg(i) + "\n"; 312 | } 313 | server.send(404, "text/plain", content); 314 | } 315 | 316 | String macToStr(const uint8_t* mac) 317 | { 318 | String result; 319 | for (int i = 0; i < 6; ++i) { 320 | result += String(mac[i], 16); 321 | if (i < 5) 322 | result += ':'; 323 | } 324 | return result; 325 | } 326 | -------------------------------------------------------------------------------- /E00_ESP_Helloworld_WiFiManager.ino: -------------------------------------------------------------------------------- 1 | /* Download WifiManager from https://github.com/tzapu/WiFiManager */ 2 | /* 3 | With this Example you don't need to configure SSID and Password before compile and load the sketch. 4 | If your node doesn't connect to your WiFi or isn't configured yet you will see an open WiFi network called "Souliss", 5 | connect to the wifi and open on your browser this address: http://192.168.4.1 and configure your WiFi, 6 | then you can open your Souliss Android App and enjoy! :) 7 | *(Chrome on Android not supported) 8 | */ 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | WiFiManager wifi(0); 15 | #define DEBUG 16 | /************************************************************************** 17 | Souliss - Hello World for Expressif ESP8266 18 | 19 | This is the basic example, create a software push-button on Android 20 | using SoulissApp (get it from Play Store). 21 | 22 | Load this code on ESP8266 board using the porting of the Arduino core 23 | for this platform. 24 | 25 | ***************************************************************************/ 26 | #define MaCaco_DEBUG_INSKETCH 27 | #define MaCaco_DEBUG 1 28 | 29 | #define VNET_DEBUG_INSKETCH 30 | #define VNET_DEBUG 1 31 | 32 | // Configure the framework 33 | #include "bconf/MCU_ESP8266.h" // Load the code directly on the ESP8266 34 | #include "conf/Gateway.h" // The main node is the Gateway, we have just one node 35 | #include "conf/IPBroadcast.h" 36 | 37 | // **** Define the WiFi name and password **** 38 | //#define WIFICONF_INSKETCH 39 | //#define WiFi_SSID "mywifi" 40 | //#define WiFi_Password "mypassword" 41 | 42 | // Include framework code and libraries 43 | #include 44 | //#include 45 | #include "Souliss.h" 46 | 47 | // This identify the number of the LED logic 48 | #define MYLEDLOGIC 0 49 | 50 | // **** Define here the right pin for your ESP module **** 51 | #define OUTPUTPIN 5 52 | 53 | void setup() 54 | { 55 | Serial.begin(115200); 56 | wifi.autoConnect("Souliss"); 57 | WiFi.mode(WIFI_STA); 58 | Initialize(); 59 | 60 | // Connect to the WiFi network and get an address from DHCP 61 | GetIPAddress(); 62 | SetAsGateway(myvNet_dhcp); // Set this node as gateway for SoulissApp 63 | 64 | // This is the vNet address for this node, used to communicate with other 65 | // nodes in your Souliss network 66 | SetAddress(0xAB01, 0xFF00, 0x0000); 67 | SetAsPeerNode(0xAB02, 1); 68 | 69 | Set_SimpleLight(MYLEDLOGIC); // Define a simple LED light logic 70 | 71 | pinMode(OUTPUTPIN, OUTPUT); // Use pin as output 72 | } 73 | 74 | void loop() 75 | { 76 | // Here we start to play 77 | EXECUTEFAST() { 78 | UPDATEFAST(); 79 | 80 | FAST_50ms() { // We process the logic and relevant input and output every 50 milliseconds 81 | Logic_SimpleLight(MYLEDLOGIC); 82 | DigOut(OUTPUTPIN, Souliss_T1n_Coil,MYLEDLOGIC); 83 | } 84 | 85 | // Here we handle here the communication with Android 86 | FAST_GatewayComms(); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /E01_ESP_DHT11.ino: -------------------------------------------------------------------------------- 1 | // Configure the framework 2 | #include "bconf/MCU_ESP8266.h" // Load the code directly on the ESP8266 3 | #include "conf/Gateway.h" // The main node is the Gateway, we have just one node 4 | #include "conf/IPBroadcast.h" 5 | 6 | // Define the WiFi name and password 7 | #define WIFICONF_INSKETCH 8 | #define WiFi_SSID "SSID" 9 | #define WiFi_Password "PASSWORD" 10 | 11 | // Include framework code and libraries 12 | #include 13 | #include 14 | #include "Souliss.h" 15 | 16 | // Include and Configure DHT11 SENSOR 17 | #include "DHT.h" 18 | #define DHTPIN 13 // what pin we're connected to 19 | #define DHTTYPE DHT11 // DHT 11 20 | DHT dht(DHTPIN, DHTTYPE, 15); 21 | 22 | // This identify the number of the LED logic 23 | #define TEMPERATURE 0 24 | #define HUMIDITY 2 25 | 26 | #define Debug Serial //Change to Serial1 if you want to use the GPIO2 to TX 27 | #define DebugDHT 1 //0 - None / 1 - Show data on Serial 28 | #define Celsius 1 //0 - Farenheit / 1 Celsius 29 | 30 | void setup() 31 | { 32 | Initialize(); 33 | 34 | Debug.begin(115200); 35 | Debug.println("DHTxx test!"); 36 | dht.begin(); 37 | 38 | // Connect to the WiFi network and get an address from DHCP 39 | GetIPAddress(); 40 | SetAsGateway(myvNet_dhcp); 41 | 42 | // This is the vNet address for this node, used to communicate with other 43 | // nodes in your Souliss network 44 | SetAddress(0xAB01, 0xFF00, 0x0000); 45 | //Example of Peer Definition 46 | //SetAsPeerNode(0xAB02, 1); 47 | 48 | 49 | Set_Temperature(TEMPERATURE); 50 | Set_Humidity(HUMIDITY); 51 | } 52 | 53 | void loop() 54 | { 55 | // Here we start to play 56 | EXECUTEFAST() { 57 | UPDATEFAST(); 58 | 59 | FAST_2110ms() 60 | { 61 | Logic_Temperature(TEMPERATURE); 62 | Logic_Humidity(HUMIDITY); 63 | } 64 | 65 | // Here we handle here the communication with Android 66 | FAST_GatewayComms(); 67 | } 68 | EXECUTESLOW() { 69 | UPDATESLOW(); 70 | SLOW_10s() { 71 | Souliss_ReadDHT(TEMPERATURE, HUMIDITY); 72 | } 73 | } 74 | } 75 | void Souliss_ReadDHT(uint8_t TEMPERATURE_SLOT, uint8_t HUMIDITY_SLOT){ 76 | // Read temperature and humidity from DHT every 10 seconds 77 | float h = dht.readHumidity(); 78 | // Read temperature as Celsius 79 | float t = dht.readTemperature(); 80 | // Read temperature as Fahrenheit 81 | float f = dht.readTemperature(true); 82 | 83 | // Check if any reads failed and exit early (to try again). 84 | if (isnan(h) || isnan(t) || isnan(f)) { 85 | Debug.println("Failed to read from DHT sensor!"); 86 | } 87 | if(DebugDHT){ 88 | Debug.print("Humidity: "); 89 | Debug.print(h); 90 | Debug.print(" %\t"); 91 | if(Celsius){ 92 | Debug.print("Temperature: "); 93 | Debug.print(t); 94 | Debug.print(" *C "); 95 | }else{ 96 | Debug.print("Temperature: "); 97 | Debug.print(f); 98 | Debug.print(" *F "); 99 | } 100 | } 101 | 102 | if(Celsius) Souliss_ImportAnalog(memory_map, TEMPERATURE_SLOT, &t); 103 | else Souliss_ImportAnalog(memory_map, TEMPERATURE_SLOT, &f); 104 | Souliss_ImportAnalog(memory_map, HUMIDITY_SLOT, &h); 105 | } 106 | -------------------------------------------------------------------------------- /E02_ESP_Dallas.ino: -------------------------------------------------------------------------------- 1 | // Configure the framework 2 | #include "bconf/MCU_ESP8266.h" // Load the code directly on the ESP8266 3 | #include "conf/Gateway.h" // The main node is the Gateway, we have just one node 4 | #include "conf/IPBroadcast.h" 5 | 6 | // Define the WiFi name and password 7 | #define WIFICONF_INSKETCH 8 | #define WiFi_SSID "SSID" 9 | #define WiFi_Password "PASSWORD" 10 | 11 | // Include framework code and libraries 12 | #include 13 | #include 14 | #include "Souliss.h" 15 | 16 | // This identify the number of the SLOT logic 17 | #define DALLAS 0 18 | 19 | #define DALLASPIN 4 //Se declara el pin donde se conectará la DATA 20 | 21 | #include 22 | #include 23 | OneWire ourWire(DALLASPIN); //Se establece el pin declarado como bus para la comunicación OneWire 24 | DallasTemperature sensors(&ourWire); //Se instancia la librería DallasTemperature 25 | 26 | #define Debug Serial //Change to Serial1 if you want to use the GPIO2 to TX 27 | 28 | void setup() 29 | { 30 | Initialize(); 31 | 32 | Serial.begin(115200); 33 | 34 | sensors.begin(); //Se inician los sensores DS18B20 35 | // Connect to the WiFi network and get an address from DHCP 36 | GetIPAddress(); 37 | SetAsGateway(myvNet_dhcp); 38 | // This is the vNet address for this node, used to communicate with other 39 | // nodes in your Souliss network 40 | SetAddress(0xAB01, 0xFF00, 0x0000); 41 | //Example of Peer Definition 42 | //SetAsPeerNode(0xAB02, 1); 43 | 44 | Set_Temperature(DALLAS); 45 | } 46 | 47 | void loop() 48 | { 49 | EXECUTEFAST() { 50 | UPDATEFAST(); 51 | 52 | FAST_910ms() { 53 | // Acquire temperature from the microcontroller ADC 54 | sensors.requestTemperatures(); //Prepara el sensor para la lectura 55 | float dallas = sensors.getTempCByIndex(0); 56 | Souliss_ImportAnalog(memory_map, DALLAS, &dallas); 57 | } 58 | 59 | FAST_2110ms() 60 | { 61 | Logic_Temperature(DALLAS); 62 | } 63 | // Here we handle here the communication with Android 64 | FAST_GatewayComms(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /E03_ESP_LDR.ino: -------------------------------------------------------------------------------- 1 | // Configure the framework 2 | #include "bconf/MCU_ESP8266.h" // Load the code directly on the ESP8266 3 | #include "conf/Gateway.h" // The main node is the Gateway, we have just one node 4 | #include "conf/IPBroadcast.h" 5 | 6 | // Define the WiFi name and password 7 | #define WIFICONF_INSKETCH 8 | #define WiFi_SSID "SSID" 9 | #define WiFi_Password "PASSWORD" 10 | 11 | // Include framework code and libraries 12 | #include 13 | #include 14 | #include "Souliss.h" 15 | 16 | // This identify the number of the LED logic 17 | #define LDR 0 18 | 19 | #define SensorLDR_pin A0 20 | 21 | // Light calibration data 22 | // out[] holds the values wanted in lux/10 23 | #define sizeofarray 9 // Number of items on out and in arrays 24 | static const unsigned int out[] = { 7, 30, 45, 65, 150, 300, 450, 2100, 13000}; // x10 //ULTIMO VALOR REFERENCIA 25 | static const unsigned int in[] = { 100, 350, 430, 500, 680, 780, 950, 1005, 1024 }; // 0 - 1024 26 | 27 | #define Debug Serial //Change to Serial1 if you want to use the GPIO2 to TX 28 | 29 | void setup() 30 | { 31 | Initialize(); 32 | 33 | Debug.begin(115200); 34 | 35 | // Connect to the WiFi network and get an address from DHCP 36 | GetIPAddress(); 37 | SetAsGateway(myvNet_dhcp); 38 | 39 | // This is the vNet address for this node, used to communicate with other 40 | // nodes in your Souliss network 41 | SetAddress(0xAB01, 0xFF00, 0x0000); 42 | //Example of Peer Definition 43 | //SetAsPeerNode(0xAB02, 1); 44 | 45 | // This node will serve all the others in the network providing an address 46 | Set_T54(LDR); 47 | } 48 | 49 | void loop() 50 | { 51 | EXECUTEFAST() { 52 | UPDATEFAST(); 53 | 54 | FAST_2110ms() 55 | { 56 | Logic_T54(LDR); 57 | } 58 | 59 | FAST_7110ms() 60 | { 61 | float ldr_read = get_lux(in, out, sizeofarray)/100.0; //ORIGINAL 62 | if (ldr_read == 0) ldr_read = 0.01; 63 | Souliss_ImportAnalog(memory_map, LDR, &ldr_read); 64 | } 65 | 66 | // Here we handle here the communication with Android 67 | FAST_GatewayComms(); 68 | } 69 | } 70 | 71 | 72 | ////////////////////////////////////////////////////////////////////////////// 73 | // Calculate lux based on rawADC reading from LDR returns value in lux/10 74 | ////////////////////////////////////////////////////////////////////////////// 75 | int get_lux(const unsigned int* _in, const unsigned int* _out, byte size) 76 | { 77 | // take care the value is within range 78 | // val = constrain(val, _in[0], _in[size-1]); 79 | 80 | int val = analogRead(A0); 81 | Debug.print("AnalogRead: "); 82 | Debug.println(val); 83 | if (val <= _in[0]) return _out[0]; 84 | if (val >= _in[size-1]) return _out[size-1]; 85 | 86 | // search right interval 87 | byte pos = 1; // _in[0] allready tested 88 | while(val > _in[pos]) pos++; 89 | 90 | // this will handle all exact "points" in the _in array 91 | if (val == _in[pos]) return _out[pos]; 92 | 93 | // interpolate in the right segment for the rest 94 | return map(val, _in[pos-1], _in[pos], _out[pos-1], _out[pos]); 95 | } 96 | -------------------------------------------------------------------------------- /E04_ESP_PWM.ino: -------------------------------------------------------------------------------- 1 | // Configure the framework 2 | #include "bconf/MCU_ESP8266.h" // Load the code directly on the ESP8266 3 | #include "conf/Gateway.h" // The main node is the Gateway, we have just one node 4 | #include "conf/IPBroadcast.h" 5 | 6 | // Define the WiFi name and password 7 | #define WIFICONF_INSKETCH 8 | #define WiFi_SSID "SSID" 9 | #define WiFi_Password "PASSWORD" 10 | 11 | // Include framework code and libraries 12 | #include 13 | #include 14 | #include "Souliss.h" 15 | 16 | // This identify the number of the SLOT logic 17 | #define LEDPWM 0 //THIS TYPICAL USES TWO SLOTS, SO THE NEXT FREE SLOT IS 2. 18 | 19 | //PWM pin 20 | #define LEDPWMP 5 21 | 22 | void setup() 23 | { 24 | analogWriteFreq(500); 25 | analogWriteRange(255); 26 | 27 | Initialize(); 28 | // Connect to the WiFi network and get an address from DHCP 29 | GetIPAddress(); 30 | SetAsGateway(myvNet_dhcp); 31 | 32 | // This is the vNet address for this node, used to communicate with other 33 | // nodes in your Souliss network 34 | SetAddress(0xAB01, 0xFF00, 0x0000); 35 | //Example of Peer Definition 36 | //SetAsPeerNode(0xAB02, 1); 37 | // This node will serve all the others in the network providing an address 38 | 39 | Set_DimmableLight(LEDPWM); 40 | 41 | pinMode(LEDPWMP, OUTPUT); 42 | } 43 | 44 | 45 | void loop() 46 | { 47 | 48 | EXECUTEFAST() { 49 | UPDATEFAST(); 50 | 51 | FAST_50ms() { // We process the logic and relevant input and output every 50 milliseconds 52 | Logic_DimmableLight(LEDPWM); 53 | analogWrite(LEDPWMP, mOutput(LEDPWM+1)); 54 | } 55 | // Here we handle here the communication with Android 56 | FAST_GatewayComms(); 57 | } 58 | EXECUTESLOW() { 59 | UPDATESLOW(); 60 | 61 | 62 | SLOW_10s() { // Read temperature and humidity from DHT every 110 seconds 63 | Timer_DimmableLight(LEDPWM); 64 | } 65 | 66 | 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /E05_ESP_BMP180.ino: -------------------------------------------------------------------------------- 1 | /*NOTES: IMPORTANT! Take care if you have a wire library on your Arduino IDE because it will be used 2 | instead of the library stored on the core of ESP. 3 | Just make a backup of Wire folder on ArduinoIDE/libraries folder and delete the folder. 4 | 5 | WIRE PIN CONFIGURATION: 6 | On the ESP library you need to call to Wire.begin() with PIN as parameters 7 | so to configure the SFE_BMP180 library you need to modify this line with Wire.begin(4.5); 8 | */ 9 | 10 | 11 | // Configure the framework 12 | #include "bconf/MCU_ESP8266.h" // Load the code directly on the ESP8266 13 | #include "conf/Gateway.h" // The main node is the Gateway, we have just one node 14 | #include "conf/IPBroadcast.h" 15 | 16 | // Define the WiFi name and password 17 | #define WIFICONF_INSKETCH 18 | #define WiFi_SSID "SSID" 19 | #define WiFi_Password "PASSWORD" 20 | 21 | 22 | // Include framework code and libraries 23 | #include 24 | #include 25 | #include "Souliss.h" 26 | 27 | 28 | // This identify the number of the LED logic 29 | #define PRESSURE0 0 30 | #define BMP180TEMP 2 31 | 32 | 33 | // SDA and SCL pins can be configured, you need to edit SFE_BMP180/SFE_BMP180.cpp line 38. Preconfigured at 14, 12. 34 | #include 35 | #include 36 | #define ALTITUDE 20.0 // Altitude of reading location in meters 37 | 38 | 39 | // You will need to create an SFE_BMP180 object, here called "pressure": 40 | SFE_BMP180 pressure; 41 | 42 | #define Debug Serial //Change to Serial1 if you want to use the GPIO2 to TX 43 | 44 | void setup() 45 | { 46 | Initialize(); 47 | Debug.begin(115200); 48 | // Connect to the WiFi network and get an address from DHCP 49 | 50 | GetIPAddress(); 51 | SetAsGateway(myvNet_dhcp); // Set this node as gateway for SoulissApp 52 | 53 | // This is the vNet address for this node, used to communicate with other 54 | // nodes in your Souliss network 55 | SetAddress(0xAB01, 0xFF00, 0x0000); 56 | //Example of Peer Definition 57 | //SetAsPeerNode(0xAB02, 1); 58 | 59 | Set_Pressure(PRESSURE0); 60 | Set_Temperature(BMP180TEMP); 61 | 62 | if (pressure.begin()) 63 | Debug.println("BMP180 init success"); 64 | else 65 | { 66 | // Oops, something went wrong, this is usually a connection problem, 67 | // see the comments at the top of this sketch for the proper connections. 68 | Debug.println("BMP180 init fail\n\n"); 69 | } 70 | } 71 | 72 | 73 | void loop() 74 | { 75 | EXECUTEFAST() { 76 | UPDATEFAST(); 77 | // Here we handle here the communication with Android 78 | FAST_GatewayComms(); 79 | } 80 | EXECUTESLOW() { 81 | UPDATESLOW(); 82 | SLOW_10s() { // Read temperature and humidity from DHT every 110 seconds 83 | Logic_Pressure(PRESSURE0); 84 | Logic_Temperature(BMP180TEMP); 85 | } 86 | SLOW_50s() { 87 | Souliss_GetPressure_BMP180(PRESSURE0,BMP180TEMP); 88 | } 89 | } 90 | } 91 | 92 | /***************************************************************************/ 93 | /* BMP180 I2C READING FUNCTION */ 94 | /***************************************************************************/ 95 | float Souliss_GetPressure_BMP180(uint8_t SLOT_PRESSURE, uint8_t SLOT_TEMPERATURE){ 96 | 97 | boolean DEBUG_PRESSURE = 0; 98 | 99 | char status; 100 | double T,P,p0,a; 101 | 102 | 103 | // Loop here getting pressure readings every 10 seconds. 104 | 105 | 106 | // If you want sea-level-compensated pressure, as used in weather reports, 107 | // you will need to know the altitude at which your measurements are taken. 108 | // We're using a constant called ALTITUDE in this sketch: 109 | 110 | if(DEBUG_PRESSURE){ 111 | Debug.println(); 112 | Debug.print("provided altitude: "); 113 | Debug.print(ALTITUDE,0); 114 | Debug.print(" meters, "); 115 | Debug.print(ALTITUDE*3.28084,0); 116 | Debug.println(" feet"); 117 | } 118 | // If you want to measure altitude, and not pressure, you will instead need 119 | // to provide a known baseline pressure. This is shown at the end of the sketch. 120 | 121 | 122 | // You must first get a temperature measurement to perform a pressure reading. 123 | 124 | // Start a temperature measurement: 125 | // If request is successful, the number of ms to wait is returned. 126 | // If request is unsuccessful, 0 is returned. 127 | 128 | 129 | status = pressure.startTemperature(); 130 | if (status != 0) 131 | { 132 | // Wait for the measurement to complete: 133 | delay(status); 134 | 135 | 136 | // Retrieve the completed temperature measurement: 137 | // Note that the measurement is stored in the variable T. 138 | // Function returns 1 if successful, 0 if failure. 139 | 140 | 141 | status = pressure.getTemperature(T); 142 | if (status != 0) 143 | { 144 | if(DEBUG_PRESSURE){ 145 | // Print out the measurement: 146 | Debug.print("temperature: "); 147 | Debug.print(T,2); 148 | Debug.print(" deg C, "); 149 | Debug.print((9.0/5.0)*T+32.0,2); 150 | Debug.println(" deg F"); 151 | } 152 | // Start a pressure measurement: 153 | // The parameter is the oversampling setting, from 0 to 3 (highest res, longest wait). 154 | // If request is successful, the number of ms to wait is returned. 155 | // If request is unsuccessful, 0 is returned. 156 | 157 | 158 | status = pressure.startPressure(3); 159 | if (status != 0) 160 | { 161 | // Wait for the measurement to complete: 162 | delay(status); 163 | 164 | 165 | // Retrieve the completed pressure measurement: 166 | // Note that the measurement is stored in the variable P. 167 | // Note also that the function requires the previous temperature measurement (T). 168 | // (If temperature is stable, you can do one temperature measurement for a number of pressure measurements.) 169 | // Function returns 1 if successful, 0 if failure. 170 | 171 | 172 | status = pressure.getPressure(P,T); 173 | if (status != 0) 174 | { 175 | if(DEBUG_PRESSURE){ 176 | // Print out the measurement: 177 | Debug.print("absolute pressure: "); 178 | Debug.print(P,2); 179 | Debug.print(" mb, "); 180 | Debug.print(P*0.0295333727,2); 181 | Debug.println(" inHg"); 182 | } 183 | // The pressure sensor returns abolute pressure, which varies with altitude. 184 | // To remove the effects of altitude, use the sealevel function and your current altitude. 185 | // This number is commonly used in weather reports. 186 | // Parameters: P = absolute pressure in mb, ALTITUDE = current altitude in m. 187 | // Result: p0 = sea-level compensated pressure in mb 188 | 189 | 190 | p0 = pressure.sealevel(P,ALTITUDE); // we're at 1655 meters (Boulder, CO) 191 | if(DEBUG_PRESSURE){ 192 | Debug.print("relative (sea-level) pressure: "); 193 | Debug.print(p0,2); 194 | Debug.print(" mb, "); 195 | Debug.print(p0*0.0295333727,2); 196 | Debug.println(" inHg"); 197 | } 198 | // On the other hand, if you want to determine your altitude from the pressure reading, 199 | // use the altitude function along with a baseline pressure (sea-level or other). 200 | // Parameters: P = absolute pressure in mb, p0 = baseline pressure in mb. 201 | // Result: a = altitude in m. 202 | 203 | 204 | a = pressure.altitude(P,p0); 205 | if(DEBUG_PRESSURE){ 206 | Debug.print("computed altitude: "); 207 | Debug.print(a,0); 208 | Debug.print(" meters, "); 209 | Debug.print(a*3.28084,0); 210 | Debug.println(" feet"); 211 | } 212 | float pressure = p0; 213 | float temperature = T; 214 | Souliss_ImportAnalog(memory_map, SLOT_PRESSURE, &pressure); 215 | Souliss_ImportAnalog(memory_map, SLOT_TEMPERATURE, &temperature); 216 | return p0; 217 | } 218 | else if(DEBUG_PRESSURE) Debug.println("error retrieving pressure measurement\n"); 219 | } 220 | else if(DEBUG_PRESSURE) Debug.println("error starting pressure measurement\n"); 221 | } 222 | else if(DEBUG_PRESSURE) Debug.println("error retrieving temperature measurement\n"); 223 | } 224 | else if(DEBUG_PRESSURE) Debug.println("error starting temperature measurement\n"); 225 | 226 | } 227 | -------------------------------------------------------------------------------- /E06_ATTINY_EMONLIB.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include "EmonLib.h" // Include Emon Library 3 | EnergyMonitor emon1; // Create an instance 4 | 5 | 6 | SoftwareSerial TinySerial(3, 4); // RX, TX 7 | #define LED 1 8 | #define CT A1 9 | 10 | 11 | void setup() 12 | { 13 | // Open serial communications and let us know we are connected 14 | TinySerial.begin(9600); // SET TO 1200 ON RECEIVER, I DONT KNOW WHY 15 | pinMode(LED, OUTPUT); 16 | emon1.current(CT, 10); // Current: input pin, calibration. 17 | } 18 | 19 | 20 | void loop() 21 | { 22 | float current = emon1.calcIrms(1480); 23 | TinySerial.print(current); 24 | delay(100); 25 | digitalWrite(LED,!digitalRead(LED)); 26 | } 27 | -------------------------------------------------------------------------------- /E06_ESP_EMONLIB.ino: -------------------------------------------------------------------------------- 1 | // Configure the framework 2 | #include "bconf/MCU_ESP8266.h" // Load the code directly on the ESP8266 3 | #include "conf/Gateway.h" // The main node is the Gateway, we have just one node 4 | #include "conf/IPBroadcast.h" 5 | 6 | // Define the WiFi name and password 7 | #define WIFICONF_INSKETCH 8 | #define WiFi_SSID "SSID" 9 | #define WiFi_Password "PASSWORD" 10 | 11 | // Include framework code and libraries 12 | #include 13 | #include 14 | #include "Souliss.h" 15 | 16 | // This identify the number of the LED logic 17 | #define CURRENT 0 18 | #define WATTS 2 19 | 20 | #define Debug Serial1 //Change to Serial1 if you want to use the GPIO2 to TX 21 | 22 | void setup() 23 | { 24 | Initialize(); 25 | 26 | Serial.begin(9600); 27 | Debug.begin(115200); 28 | 29 | // Connect to the WiFi network and get an address from DHCP 30 | GetIPAddress(); 31 | SetAsGateway(myvNet_dhcp); 32 | // This node will serve all the others in the network providing an address 33 | 34 | // This is the vNet address for this node, used to communicate with other 35 | // nodes in your Souliss network 36 | SetAddress(0xAB01, 0xFF00, 0x0000); 37 | //Example of Peer Definition 38 | //SetAsPeerNode(0xAB02, 1); 39 | 40 | Set_Current(CURRENT); 41 | Set_Power(WATTS); 42 | } 43 | 44 | void loop() 45 | { 46 | 47 | EXECUTEFAST() { 48 | UPDATEFAST(); 49 | 50 | FAST_510ms() { 51 | Logic_Current(CURRENT); 52 | Logic_Power(WATTS); 53 | } 54 | FAST_710ms() { 55 | float current = 0; 56 | if(Serial.available()){ 57 | float current = Serial.parseFloat(); 58 | Debug.println(current); 59 | 60 | Souliss_ImportAnalog(memory_map, CURRENT, ¤t); 61 | float watt = current*230; 62 | Souliss_ImportAnalog(memory_map, WATTS, &watt); 63 | } 64 | } 65 | // Here we handle here the communication with Android 66 | FAST_GatewayComms(); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /E07_PIR_with_LDR.ino: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | Souliss - Light with PIR Sensor 3 | 4 | This example handle two lights as previous example but add an external 5 | event (like a PIR sensor) to time-on the light in the active state. 6 | 7 | If the device is set in AUTO mode, the external event drive the output 8 | state, is always possible to control manually the light. 9 | 10 | Run this code on one of the following boards: 11 | - Arduino Ethernet (W5100) 12 | - Arduino with Ethernet Shield (W5100) 13 | 14 | As option you can run the same code on the following, just changing the 15 | relevant configuration file at begin of the sketch 16 | - Arduino with ENC28J60 Ethernet Shield 17 | - Arduino with W5200 Ethernet Shield 18 | - Arduino with W5500 Ethernet Shield 19 | 20 | ***************************************************************************/ 21 | 22 | 23 | // Configure the framework 24 | #include "bconf/StandardArduino.h" // Use a standard Arduino 25 | #include "conf/ethW5100.h" // Ethernet through Wiznet W5100 26 | #include "conf/Gateway.h" // The main node is the Gateway, we have just one node 27 | #include "conf/Webhook.h" // Enable DHCP and DNS 28 | 29 | // Include framework code and libraries 30 | #include 31 | #include "Souliss.h" 32 | 33 | #define PIR 0 34 | #define LDR 1 35 | 36 | #define LIGHT_ON_CYCLE 10 // Light ON for 10 cycles if triggered by a PIR sensor 37 | 38 | #define LDR_THRESOLD 500 39 | 40 | //DEFINICION DE PINES 41 | #define LIGHT_PIN 8 42 | #define BUTTON_PIN 2 43 | #define PIR_PIN 9 44 | #define LDR_PIN A0 45 | 46 | void setup() 47 | { 48 | Initialize(); 49 | 50 | // Get the IP address from DHCP 51 | GetIPAddress(); 52 | SetAsGateway(myvNet_dhcp); // Set this node as gateway for SoulissApp 53 | 54 | // Set the typical logic to handle the lights 55 | Set_AutoLight(PIR); 56 | Set_T54(LDR); 57 | 58 | // Define inputs, outputs pins 59 | pinMode(LDR_PIN, INPUT); 60 | pinMode(PIR_PIN, INPUT); 61 | pinMode(BUTTON_PIN, INPUT); // Hardware pulldown required 62 | pinMode(LIGHT_PIN, OUTPUT); // Power to relay coil for light 1 63 | } 64 | 65 | void loop() 66 | { 67 | // Here we start to play 68 | EXECUTEFAST() { 69 | UPDATEFAST(); 70 | 71 | // Execute the code every 3 time_base_fast 72 | FAST_90ms() { 73 | 74 | //Auto Mode when LDR <= LDR_THRESOLD 75 | if(mOutput(PIR) != Souliss_T1n_AutoCmd && mOutputasFloat(LDR) <= LDR_THRESOLD) 76 | mInput(PIR) = Souliss_T1n_AutoCmd; 77 | 78 | //Off Mode when LDR >= LDR_THRESOLD 79 | if(mOutput(PIR) == Souliss_T1n_AutoCmd && mOutputasFloat(LDR) >= LDR_THRESOLD) 80 | mInput(PIR) == Souliss_T1n_OffCmd; 81 | 82 | // Use BUTTON_PIN to Toggle On/Off 83 | DigIn(BUTTON_PIN, Souliss_T1n_ToggleCmd, PIR); 84 | 85 | // Use PIR_PIN to enable on Presence detection and Auto_mode ON 86 | DigIn(PIR_PIN, LIGHT_ON_CYCLE, PIR); 87 | 88 | // Execute the logic 89 | Logic_AutoLight(PIR); 90 | Logic_T54(LDR); 91 | 92 | // Use Pin8 and Pin 9 as output on the electrical load 93 | nDigOut(LIGHT_PIN, Souliss_T1n_Coil, PIR); 94 | } 95 | FAST_910ms(){ 96 | AnalogIn(LDR_PIN, LDR, 0.09, 0); 97 | } 98 | 99 | // Process data communication 100 | FAST_GatewayComms(); 101 | 102 | } 103 | 104 | EXECUTESLOW() { 105 | UPDATESLOW(); 106 | 107 | SLOW_10s() { 108 | 109 | // The timer handle timed-on states 110 | Timer_AutoLight(PIR); 111 | } 112 | } 113 | } 114 | 115 | -------------------------------------------------------------------------------- /ESPmaster_ArduinoSlave/ArduinoSlave/ArduinoSlave.ino: -------------------------------------------------------------------------------- 1 | /* Sketch by Jose Manuel Loureiro 2 | * Arduino slave 3 | 4 | Recive char y convierte en tres int[3]= int[0].int[1].int[2]. 5 | *tb hay que mandar el último punto 6 | 7 | Esp send: int[0] int[1] int[2] 8 | 9 | digital write 1 pin value 10 | digital read 2 pin 0(else) 11 | analog write 3 pin value 12 | analog read 4 pin 0(else) 13 | store variable 5 nVar value 14 | get variable 6 nvar 0(else) 15 | configure pin 7 pin confVal 16 | send eeprom values 8 0 0(else) 17 | clear pinConf 8 1 0(else) 18 | reset arduino 9 0(else) 0(esle) 19 | 20 | confVal 21 | 1 digital in 22 | 2 digital out start low 23 | 3 digital out start high 24 | 4 analog out (PWM) 25 | 5 digital imput_pullup 26 | **faltaria añadir configuraciones para objetos(rtc,dht...) 27 | 28 | uso con IDE serial monitor 29 | upload the code 30 | 8.0.0. clear eeprom 31 | 7.13.2. configura el pin 13 como salida digital que comienza su estado en low 32 | 9.0.0. guarda conf en eeprom y resetea arduino 33 | 1.13.1. enciende el led de pin 13 34 | 1.13.0. apaga el led del pin 13 35 | 5.0.1380. guarda 1380 en nVar[0] 36 | 6.0.0. devuelve el valor de nVar[0] "6.0.1380." 37 | 38 | Integración con SS 39 | Un ESP con el codigo de ss y sin declarar usart 40 | 41 | ESP setup 42 | Serial.begin(9600); 43 | 44 | delay(3000); //wait arduino on 45 | Serial.println("7.3.3.");//configure.pin5.digOut start high 46 | Serial.println("7.4.3.");//pin4 47 | Serial.println("7.5.3.");//pin5 48 | Serial.println("7.6.3.");//pin6 49 | Serial.println("9.0.0.");//reset arduino if needed 50 | delay(4000); //wait arduino after reset 51 | 52 | ESP loop 53 | (...) 54 | Logic_SimpleLight(SLOT0); 55 | if(mOutput(SLOT0)!=lastSLOT0){ 56 | Serial.print("1.6."); //dWrite.pin6. 57 | Serial.print(!mOutput(SLOT0));//! Relay(=lowDigOut) 58 | Serial.println("."); //si es un led no usar (!) 59 | lastSLOT0=mOutput(SLOT0);} 60 | Falta: 61 | faltaria añadir configuraciones para objetos 62 | Hecho: 63 | -v05 aññadido imput pullup y eliminado analog conf 64 | -v05 añadido clear pinConf 65 | -v05 añadido enviar pinConf 66 | -v05 añadido intercambio de variables 67 | -v04 antes de resetear comparar si sirve la comfiguración actual 68 | 69 | */ 70 | #include 71 | #include //for software reset 72 | 73 | byte pinConf[14];//0,1 serial(not used) 74 | //D2-D13 75 | String inputString= ""; 76 | int inputInt[3]; 77 | boolean stringComplete = false; 78 | byte index=0; 79 | bool needReseT=0; 80 | ///* 81 | int nVar[10]; 82 | //*/ 83 | //======================================================= 84 | void setup() { 85 | Serial.begin(9600); 86 | 87 | //pin conf 88 | eepromRead(); 89 | for (int i=2;i<14;i++) { 90 | if(pinConf[i]==1){ //digital in 91 | pinMode(i,INPUT);} 92 | if(pinConf[i]==2){ //digital out start low 93 | digitalWrite(i,LOW); 94 | pinMode(i,OUTPUT);} 95 | if(pinConf[i]==3){ //digital out start high 96 | digitalWrite(i,HIGH); 97 | pinMode(i,OUTPUT);} 98 | if(pinConf[i]==4&&(i==3||i==5||i==6||i==9||i==10||i==11)){//analog out 99 | pinMode(i,OUTPUT);} 100 | if(pinConf[i]==5){ //digital input_pullup 101 | pinMode(i,INPUT_PULLUP);} 102 | } 103 | } 104 | 105 | //======================================================= 106 | void loop() { 107 | 108 | serialEvent(); 109 | 110 | if(millis()%15000==0){}//No quitar, sin no funciona 111 | 112 | if (stringComplete) { 113 | switch(inputInt[0]){ 114 | case 1: //digital write 115 | if(1 25 | #include 26 | #include 27 | //---------------------------------------------------- 28 | // 4. Slots 29 | //---------------------------------------------------- 30 | #define SLOT0 0 31 | #define SLOT1 1 32 | #define SLOT2 2 33 | #define SLOT3 3 34 | #define SLOT4 4//&5 35 | //---------------------------------------------------- 36 | // 6. Comandos 37 | //---------------------------------------------------- 38 | bool lastSLOT0; 39 | bool lastSLOT1; 40 | bool lastSLOT2; 41 | bool lastSLOT3; 42 | 43 | byte pinConf[14];//0,1 serial(not used) 44 | //D2-D13 45 | String inputString= ""; // a string to hold incoming data 46 | int inputInt[3]; 47 | bool stringComplete = false; // whether the string is complete 48 | byte indeX=0; 49 | ///* if no needed 50 | int nVar[10]; 51 | //*/ 52 | bool dr[14]; 53 | float ar[8]; 54 | 55 | //======================================================= 56 | void setup() 57 | { 58 | Initialize(); 59 | SetAPoint();//**************SetAccessPoint*********// 60 | SetAsGateway(myvNet_dhcp); 61 | //---------------------------------------------------- 62 | //S2. Set vNet Address 63 | //---------------------------------------------------- 64 | SetAddress(0xAB01, 0xFF00, 0x0000); 65 | //---------------------------------------------------- 66 | // S4. Set the typicals for this node 67 | //---------------------------------------------------- 68 | Set_SimpleLight(SLOT0); 69 | Set_SimpleLight(SLOT1); 70 | Set_SimpleLight(SLOT2); 71 | Set_SimpleLight(SLOT3); 72 | Set_T51(SLOT4); 73 | 74 | Serial.begin(9600); 75 | 76 | delay(3000); //wait arduino on 77 | Serial.println("8.0.0.");//clear arduino pinConf 78 | //?ever needed 79 | Serial.println("7.14.5.");//conf.A0.analog in 80 | Serial.println("7.3.3."); //conf.pin5.digOut start high 81 | Serial.println("7.4.3."); //pin4 82 | Serial.println("7.5.3."); 83 | Serial.println("7.6.3."); 84 | Serial.println("9.0.0."); //reset arduino if needed 85 | delay(4000); //wait arduino after reset 86 | } 87 | 88 | //======================================================= 89 | void loop() 90 | { 91 | serialEvent(); 92 | EXECUTEFAST() { 93 | UPDATEFAST(); 94 | 95 | FAST_50ms() { 96 | Logic_SimpleLight(SLOT0); 97 | if(mOutput(SLOT0)!=lastSLOT0){ 98 | Serial.print("1.6."); 99 | Serial.print(!mOutput(SLOT0));//! Relay(=lowDigOut) 100 | Serial.println("."); 101 | lastSLOT0=mOutput(SLOT0);} 102 | Logic_SimpleLight(SLOT1); 103 | if(mOutput(SLOT1)!=lastSLOT1){ 104 | Serial.print("1.5."); 105 | Serial.print(!mOutput(SLOT1)); 106 | Serial.println("."); 107 | lastSLOT1=mOutput(SLOT1);} 108 | Logic_SimpleLight(SLOT2); 109 | if(mOutput(SLOT2)!=lastSLOT2){ 110 | Serial.print("1.4."); 111 | Serial.print(!mOutput(SLOT2)); 112 | Serial.println("."); 113 | lastSLOT2=mOutput(SLOT2);} 114 | Logic_SimpleLight(SLOT3); 115 | if(mOutput(SLOT3)!=lastSLOT3){ 116 | Serial.print("1.3."); 117 | Serial.print(!mOutput(SLOT3)); 118 | Serial.println("."); 119 | lastSLOT3=mOutput(SLOT3);} 120 | } 121 | 122 | FAST_50ms() { 123 | Read_T51(SLOT4); 124 | Serial.print("4.14.0."); 125 | ImportAnalog(SLOT4,&ar[0]); 126 | } 127 | FAST_GatewayComms(); 128 | } 129 | EXECUTESLOW() { 130 | UPDATESLOW(); 131 | } 132 | if (stringComplete) { 133 | switch(inputInt[0]){ 134 | case 2: //digital read 135 | if(1 23 | #include 24 | #include 25 | #include 26 | 27 | // Configure the Souliss framework 28 | #include "bconf/MCU_ESP8266.h" // Load the code directly on the ESP8266 29 | #include "conf/RuntimeGateway.h" // This node is a Peer and can became a Gateway at runtime 30 | #include "conf/DynamicAddressing.h" // Use dynamically assigned addresses 31 | #include "conf/WEBCONFinterface.h" // Enable the WebConfig interface 32 | 33 | #include "Souliss.h" 34 | 35 | #define MYLED 0 36 | uint8_t GPIO_POUT = 15; //GPIO15 37 | 38 | void setup() 39 | { 40 | Serial.begin(115200); 41 | Initialize(); 42 | 43 | // Read the IP configuration from the EEPROM, if not available start 44 | // the node as access point 45 | if(!ReadIPConfiguration()) 46 | { 47 | // Start the node as access point with a configuration WebServer 48 | SetAccessPoint(); 49 | startWebServer(); 50 | 51 | // We have nothing more than the WebServer for the configuration 52 | // to run, once configured the node will quit this. 53 | while(1) 54 | { 55 | yield(); 56 | runWebServer(); 57 | } 58 | startWebServer(); 59 | } 60 | 61 | if (IsRuntimeGateway()) 62 | { 63 | // Connect to the WiFi network and get an address from DHCP 64 | SetAsGateway(myvNet_dhcp); // Set this node as gateway for SoulissApp 65 | SetAddressingServer(); 66 | } 67 | else 68 | { 69 | // This board request an address to the gateway at runtime, no need 70 | // to configure any parameter here. 71 | SetDynamicAddressing(); 72 | GetAddress(); 73 | } 74 | 75 | Set_DimmableLight(MYLED); 76 | 77 | } 78 | 79 | void loop() 80 | { 81 | runWebServer(); 82 | 83 | EXECUTEFAST() { 84 | UPDATEFAST(); 85 | 86 | FAST_50ms() { // We process the logic and relevant input and output every 50 milliseconds 87 | Logic_DimmableLight(MYLED); 88 | analogWrite(GPIO_POUT, mOutput(MYLED+1)*4); 89 | } 90 | 91 | // Run communication as Gateway or Peer 92 | if (IsRuntimeGateway()) 93 | FAST_GatewayComms(); 94 | else 95 | FAST_PeerComms(); 96 | } 97 | 98 | EXECUTESLOW() { 99 | UPDATESLOW(); 100 | 101 | SLOW_10s() { // Read temperature and humidity from DHT every 110 seconds 102 | Timer_DimmableLight(MYLED); 103 | } 104 | 105 | // If running as Peer 106 | if (!IsRuntimeGateway()) 107 | SLOW_PeerJoin(); 108 | } 109 | } 110 | 111 | -------------------------------------------------------------------------------- /SoulissDomo_Device_Example/Souliss_ESP_WebInterface_Simplified/PAGE_NetworkConfiguration.h: -------------------------------------------------------------------------------- 1 | // 2 | // HTML PAGE 3 | // 4 | const char PAGE_NetworkConfiguration[] PROGMEM = R"=====( 5 | 6 | 7 | <  Network Configuration 8 |


9 | Connect to Router with these settings:
10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
Enabled this Node as Gateway?:
SSID:
Password:
DHCP:
IP: ...
Netmask:...
Gateway:...
22 |
23 |
24 | You will need only ONE Gateway Node, If this is your First Node you must enabled it as Gateway.. 25 | Connection State:
N/A
26 |
27 | Networks:
28 | 29 | 30 | 31 |
Scanning...
Refresh
32 | 33 | 34 | 63 | 64 | 65 | )====="; 66 | 67 | const char PAGE_WaitAndReload[] PROGMEM = R"=====( 68 | 69 | Please Wait....Configuring and Restarting. 70 | )====="; 71 | 72 | 73 | // 74 | // SEND HTML PAGE OR IF A FORM SUMBITTED VALUES, PROCESS THESE VALUES 75 | // 76 | 77 | void send_network_configuration_html() 78 | { 79 | 80 | if (server.args() > 0 ) // Save Settings 81 | { 82 | String temp = ""; 83 | config.dhcp = false; 84 | config.NodeMode = false; 85 | for ( uint8_t i = 0; i < server.args(); i++ ) { 86 | if (server.argName(i) == "ssid") config.ssid = urldecode(server.arg(i)); 87 | if (server.argName(i) == "password") config.password = urldecode(server.arg(i)); 88 | if (server.argName(i) == "ip_0") if (checkRange(server.arg(i))) config.IP[0] = server.arg(i).toInt(); 89 | if (server.argName(i) == "ip_1") if (checkRange(server.arg(i))) config.IP[1] = server.arg(i).toInt(); 90 | if (server.argName(i) == "ip_2") if (checkRange(server.arg(i))) config.IP[2] = server.arg(i).toInt(); 91 | if (server.argName(i) == "ip_3") if (checkRange(server.arg(i))) config.IP[3] = server.arg(i).toInt(); 92 | if (server.argName(i) == "nm_0") if (checkRange(server.arg(i))) config.Netmask[0] = server.arg(i).toInt(); 93 | if (server.argName(i) == "nm_1") if (checkRange(server.arg(i))) config.Netmask[1] = server.arg(i).toInt(); 94 | if (server.argName(i) == "nm_2") if (checkRange(server.arg(i))) config.Netmask[2] = server.arg(i).toInt(); 95 | if (server.argName(i) == "nm_3") if (checkRange(server.arg(i))) config.Netmask[3] = server.arg(i).toInt(); 96 | if (server.argName(i) == "gw_0") if (checkRange(server.arg(i))) config.Gateway[0] = server.arg(i).toInt(); 97 | if (server.argName(i) == "gw_1") if (checkRange(server.arg(i))) config.Gateway[1] = server.arg(i).toInt(); 98 | if (server.argName(i) == "gw_2") if (checkRange(server.arg(i))) config.Gateway[2] = server.arg(i).toInt(); 99 | if (server.argName(i) == "gw_3") if (checkRange(server.arg(i))) config.Gateway[3] = server.arg(i).toInt(); 100 | if (server.argName(i) == "dhcp") config.dhcp = true; 101 | if (server.argName(i) == "mnenabled") config.NodeMode = true; 102 | } 103 | server.send (200, "text/html", reinterpret_cast(PAGE_WaitAndReload )); 104 | LOG.println("Write Config"); 105 | WriteConfig(); 106 | ConfigureWifi(); 107 | } 108 | else 109 | { 110 | server.send ( 200, "text/html", PAGE_NetworkConfiguration ); 111 | 112 | } 113 | LOG.println(__FUNCTION__); 114 | } 115 | 116 | 117 | 118 | // 119 | // FILL THE PAGE WITH VALUES 120 | // 121 | 122 | void send_network_configuration_values_html() 123 | { 124 | 125 | String values =""; 126 | 127 | values += "ssid|" + (String) config.ssid + "|input\n"; 128 | values += "password|" + (String) config.password + "|input\n"; 129 | values += "ip_0|" + (String) config.IP[0] + "|input\n"; 130 | values += "ip_1|" + (String) config.IP[1] + "|input\n"; 131 | values += "ip_2|" + (String) config.IP[2] + "|input\n"; 132 | values += "ip_3|" + (String) config.IP[3] + "|input\n"; 133 | values += "nm_0|" + (String) config.Netmask[0] + "|input\n"; 134 | values += "nm_1|" + (String) config.Netmask[1] + "|input\n"; 135 | values += "nm_2|" + (String) config.Netmask[2] + "|input\n"; 136 | values += "nm_3|" + (String) config.Netmask[3] + "|input\n"; 137 | values += "gw_0|" + (String) config.Gateway[0] + "|input\n"; 138 | values += "gw_1|" + (String) config.Gateway[1] + "|input\n"; 139 | values += "gw_2|" + (String) config.Gateway[2] + "|input\n"; 140 | values += "gw_3|" + (String) config.Gateway[3] + "|input\n"; 141 | values += "dhcp|" + (String) (config.dhcp ? "checked" : "") + "|chk\n"; 142 | values += "mnenabled|" + (String) (config.NodeMode ? "checked" : "") + "|chk\n"; 143 | server.send ( 200, "text/plain", values); 144 | LOG.println(__FUNCTION__); 145 | 146 | } 147 | 148 | 149 | // 150 | // FILL THE PAGE WITH NETWORKSTATE & NETWORKS 151 | // 152 | 153 | void send_connection_state_values_html() 154 | { 155 | 156 | String state = "N/A"; 157 | String Networks = ""; 158 | if (WiFi.status() == 0) state = "Idle"; 159 | else if (WiFi.status() == 1) state = "NO SSID AVAILBLE"; 160 | else if (WiFi.status() == 2) state = "SCAN COMPLETED"; 161 | else if (WiFi.status() == 3) state = "CONNECTED"; 162 | else if (WiFi.status() == 4) state = "CONNECT FAILED"; 163 | else if (WiFi.status() == 5) state = "CONNECTION LOST"; 164 | else if (WiFi.status() == 6) state = "DISCONNECTED"; 165 | 166 | 167 | 168 | int n = WiFi.scanNetworks(); 169 | 170 | if (n == 0) 171 | { 172 | Networks = "No networks found!"; 173 | } 174 | else 175 | { 176 | 177 | 178 | Networks = "Found " +String(n) + " Networks
"; 179 | Networks += ""; 180 | Networks += ""; 181 | for (int i = 0; i < n; ++i) 182 | { 183 | int quality=0; 184 | if(WiFi.RSSI(i) <= -100) 185 | { 186 | quality = 0; 187 | } 188 | else if(WiFi.RSSI(i) >= -50) 189 | { 190 | quality = 100; 191 | } 192 | else 193 | { 194 | quality = 2 * (WiFi.RSSI(i) + 100); 195 | } 196 | 197 | 198 | Networks += ""; 199 | } 200 | Networks += "
NameQualityEnc
" + String(WiFi.SSID(i)) + "" + String(quality) + "%" + String((WiFi.encryptionType(i) == ENC_TYPE_NONE)?" ":"*") + "
"; 201 | } 202 | 203 | String values =""; 204 | values += "connectionstate|" + state + "|div\n"; 205 | values += "networks|" + Networks + "|div\n"; 206 | server.send ( 200, "text/plain", values); 207 | LOG.println(__FUNCTION__); 208 | 209 | } 210 | 211 | -------------------------------------------------------------------------------- /SoulissDomo_Device_Example/Souliss_ESP_WebInterface_Simplified/Page_Admin.h: -------------------------------------------------------------------------------- 1 | // 2 | // HTML PAGE 3 | // 4 | 5 | const char PAGE_AdminMainPage[] PROGMEM = R"=====( 6 | 7 | 8 |

Souliss Node Administration

9 |
10 | Network Configuration
11 | Main Interface
12 |
13 |
14 | Clicking Main Interface Button will leaving Access Point Mode, 15 | Please make a note of your IP Address Node in Network Information 16 |

You can enter this Web Interface again by your NEW IP Address Node given from Network Information.

17 | 18 | 34 | 35 | )====="; 36 | 37 | void filldynamicdata() 38 | { 39 | //Serial.println("Dynamic Data Run"); 40 | String values =""; 41 | values += "mydynamicdata|" + (String) + "Souliss Node, Millis since start: " + (String) millis() + "|div\n"; // Build a string, like this: ID|VALUE|TYPE 42 | server.send ( 200, "text/plain", values); 43 | 44 | } 45 | -------------------------------------------------------------------------------- /SoulissDomo_Device_Example/Souliss_ESP_WebInterface_Simplified/Page_Root.h: -------------------------------------------------------------------------------- 1 | const char PAGE_Root[] PROGMEM = R"=====( 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | It work's! 13 | 14 | 15 | 16 | )====="; 17 | 18 | void sendRootPage() 19 | { 20 | if (server.args() > 0 ) // Are there any POST/GET Fields ? 21 | { 22 | for ( uint8_t i = 0; i < server.args(); i++ ) { // Iterate through the fields 23 | 24 | } 25 | } 26 | server.send ( 200, "text/html", reinterpret_cast(PAGE_Root) ); 27 | } 28 | -------------------------------------------------------------------------------- /SoulissDomo_Device_Example/Souliss_ESP_WebInterface_Simplified/Page_Script.js.h: -------------------------------------------------------------------------------- 1 | 2 | const char PAGE_microajax_js[] PROGMEM = R"=====( 3 | function microAjax(B,A){this.bindFunction=function(E,D){return function(){return E.apply(D,[D])}};this.stateChange=function(D){if(this.request.readyState==4){this.callbackFunction(this.request.responseText)}};this.getRequest=function(){if(window.ActiveXObject){return new ActiveXObject("Microsoft.XMLHTTP")}else{if(window.XMLHttpRequest){return new XMLHttpRequest()}}return false};this.postBody=(arguments[2]||"");this.callbackFunction=A;this.url=B;this.request=this.getRequest();if(this.request){var C=this.request;C.onreadystatechange=this.bindFunction(this.stateChange,this);if(this.postBody!==""){C.open("POST",B,true);C.setRequestHeader("X-Requested-With","XMLHttpRequest");C.setRequestHeader("Content-type","application/x-www-form-urlencoded");C.setRequestHeader("Connection","close")}else{C.open("GET",B,true)}C.send(this.postBody)}}; 4 | 5 | function setValues(url) 6 | { 7 | microAjax(url, function (res) 8 | { 9 | res.split(String.fromCharCode(10)).forEach(function(entry) { 10 | fields = entry.split("|"); 11 | if(fields[2] == "input") 12 | { 13 | document.getElementById(fields[0]).value = fields[1]; 14 | } 15 | else if(fields[2] == "div") 16 | { 17 | document.getElementById(fields[0]).innerHTML = fields[1]; 18 | } 19 | else if(fields[2] == "chk") 20 | { 21 | document.getElementById(fields[0]).checked = fields[1]; 22 | } 23 | }); 24 | }); 25 | } 26 | 27 | )====="; 28 | 29 | 30 | -------------------------------------------------------------------------------- /SoulissDomo_Device_Example/Souliss_ESP_WebInterface_Simplified/Page_Style.css.h: -------------------------------------------------------------------------------- 1 | const char PAGE_Style_css[] PROGMEM = R"=====( 2 | body { color: #000000; font-family: avenir, helvetica, arial, sans-serif; letter-spacing: 0.15em;} 3 | hr { background-color: #eee; border: 0 none; color: #eee; height: 1px; } 4 | .btn, .btn:link, .btn:visited { 5 | border-radius: 0.3em; 6 | border-style: solid; 7 | border-width: 1px; 8 | color: #111; 9 | display: inline-block; 10 | font-family: avenir, helvetica, arial, sans-serif; 11 | letter-spacing: 0.15em; 12 | margin-bottom: 0.5em; 13 | padding: 1em 0.75em; 14 | text-decoration: none; 15 | text-transform: uppercase; 16 | -webkit-transition: color 0.4s, background-color 0.4s, border 0.4s; 17 | transition: color 0.4s, background-color 0.4s, border 0.4s; 18 | } 19 | .btn:hover, .btn:focus { 20 | color: #7FDBFF; 21 | border: 1px solid #7FDBFF; 22 | -webkit-transition: background-color 0.3s, color 0.3s, border 0.3s; 23 | transition: background-color 0.3s, color 0.3s, border 0.3s; 24 | } 25 | .btn:active { 26 | color: #0074D9; 27 | border: 1px solid #0074D9; 28 | -webkit-transition: background-color 0.3s, color 0.3s, border 0.3s; 29 | transition: background-color 0.3s, color 0.3s, border 0.3s; 30 | } 31 | .btn--s 32 | { 33 | font-size: 12px; 34 | } 35 | .btn--m { 36 | font-size: 14px; 37 | } 38 | .btn--l { 39 | font-size: 20px; border-radius: 0.25em !important; 40 | } 41 | .btn--full, .btn--full:link { 42 | border-radius: 0.25em; 43 | display: block; 44 | margin-left: auto; 45 | margin-right: auto; 46 | text-align: center; 47 | width: 100%; 48 | } 49 | .btn--blue:link, .btn--blue:visited { 50 | color: #fff; 51 | background-color: #0074D9; 52 | } 53 | .btn--blue:hover, .btn--blue:focus { 54 | color: #fff !important; 55 | background-color: #0063aa; 56 | border-color: #0063aa; 57 | } 58 | .btn--blue:active { 59 | color: #fff; 60 | background-color: #001F3F; border-color: #001F3F; 61 | } 62 | @media screen and (min-width: 32em) { 63 | .btn--full { 64 | max-width: 16em !important; } 65 | } 66 | )====="; 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /SoulissDomo_Device_Example/Souliss_ESP_WebInterface_Simplified/Souliss_ESP_WebInterface_Simplified.ino: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | Souliss - ESP Juan Pinto Configurable Board. 3 | 4 | This is the basic example, create a software push-button on Android 5 | using SoulissApp (get it from Play Store). 6 | 7 | Load this code on ESP8266 board using the porting of the Arduino core 8 | for this platform. 9 | 10 | ***************************************************************************/ 11 | #define MaCaco_DEBUG_INSKETCH 12 | #define MaCaco_DEBUG 1 13 | 14 | #define VNET_DEBUG_INSKETCH 15 | #define VNET_DEBUG 1 16 | //Changed Webinterface with the new one 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | const byte DNS_PORT = 53; 26 | IPAddress apIP(192, 168, 4, 1); 27 | DNSServer dnsServer; 28 | 29 | #define ACCESS_POINT_NAME "Souliss" 30 | //#define ACCESS_POINT_PASSWORD "12345678" 31 | 32 | #define LOG Serial 33 | 34 | // Configure the framework 35 | #include "bconf/MCU_ESP8266.h" // Load the code directly on the ESP8266 36 | #include "conf/Gateway.h" // The main node is the Gateway, we have just one node 37 | #include "conf/DynamicAddressing.h" 38 | 39 | //************** Include framework code and libraries ************************* 40 | #include "conf/IPBroadcast.h" 41 | #include "Souliss.h" 42 | 43 | //NEW WEBINTERFACE INCLUDES 44 | #include "helpers.h" 45 | #include "global.h" 46 | //Include the HTML, STYLE and Script "Pages" 47 | #include "Page_Root.h" 48 | #include "Page_Admin.h" 49 | #include "Page_Script.js.h" 50 | #include "Page_Style.css.h" 51 | #include "PAGE_NetworkConfiguration.h" 52 | #include "main.h" 53 | 54 | 55 | #define AdminTimeOut 300 // Defines the Time in Seconds, when the Admin-Mode will be diabled 56 | 57 | #define MYLED 0 58 | 59 | void setup() 60 | { 61 | EEPROM.begin(STORE__SIZE); 62 | LOG.begin(115200); 63 | delay(500); 64 | 65 | /* for(int i=0;i(PAGE_AdminMainPage)); } ); 109 | server.on ( "/", []() { LOG.println("admin.html"); server.send ( 200, "text/html", reinterpret_cast(PAGE_AdminMainPage)); } ); 110 | server.on ( "/admin/processMain", processMain); 111 | server.on ( "/admin/filldynamicdata", filldynamicdata ); 112 | server.on ( "/favicon.ico", []() { LOG.println("favicon.ico"); server.send ( 200, "text/html", "" ); } ); 113 | server.on ( "/admin.html", []() { LOG.println("admin.html"); server.send ( 200, "text/html", reinterpret_cast(PAGE_AdminMainPage)); } ); 114 | server.on ( "/config.html", send_network_configuration_html ); 115 | server.on ( "/main.html", processMain ); 116 | server.on ( "/main.html", []() { server.send ( 200, "text/html", PAGE_main ); } ); 117 | server.on ( "/style.css", []() { LOG.println("style.css"); server.send ( 200, "text/plain", reinterpret_cast( PAGE_Style_css )); } ); 118 | server.on ( "/microajax.js", []() { LOG.println("microajax.js"); server.send ( 200, "text/plain", reinterpret_cast(PAGE_microajax_js )); } ); 119 | server.on ( "/admin/values", send_network_configuration_values_html ); 120 | server.on ( "/admin/connectionstate", send_connection_state_values_html ); 121 | server.on ( "/admin/rstvalues", send_reset_values_html); 122 | server.begin(); 123 | LOG.println( "HTTP server started" ); 124 | 125 | Souliss_Node_Start(); 126 | 127 | Set_DimmableLight(MYLED); 128 | 129 | } 130 | 131 | void loop() 132 | { 133 | if (AdminEnabled) 134 | { 135 | if (AdminTimeOutCounter > AdminTimeOut) 136 | { 137 | AdminEnabled = false; 138 | LOG.println("Admin Mode disabled!"); 139 | WiFi.mode(WIFI_STA); 140 | LOG.println( "STA mode started" ); 141 | LOG.println(WiFi.localIP()); 142 | } 143 | } 144 | //if(nowifi) 145 | dnsServer.processNextRequest(); 146 | server.handleClient(); 147 | 148 | //************************************************************************************************** 149 | EXECUTEFAST() { 150 | UPDATEFAST(); 151 | 152 | FAST_50ms() { // We process the logic and relevant input and output every 50 milliseconds 153 | Logic_DimmableLight(MYLED); 154 | analogWrite(15, mOutput(MYLED+1)*4); 155 | } 156 | 157 | if (config.NodeMode){ 158 | // Here we handle here the communication with Android as Gateway 159 | FAST_GatewayComms(); 160 | } 161 | else { 162 | // Here we handle here the communication with Android as Peer 163 | FAST_PeerComms(); 164 | } 165 | } 166 | EXECUTESLOW() { 167 | UPDATESLOW(); 168 | 169 | SLOW_10s() { // Read temperature and humidity from DHT every 110 seconds 170 | Timer_DimmableLight(MYLED); 171 | } 172 | if (config.NodeMode){ 173 | //nothing here 174 | } 175 | else { 176 | SLOW_PeerJoin(); 177 | } 178 | } 179 | 180 | if (config.NodeMode){ 181 | //nothing here 182 | } 183 | else { 184 | START_PeerJoin(); //tell gateway that i am exist 185 | } 186 | } 187 | -------------------------------------------------------------------------------- /SoulissDomo_Device_Example/Souliss_ESP_WebInterface_Simplified/global.h: -------------------------------------------------------------------------------- 1 | #ifndef GLOBAL_H 2 | #define GLOBAL_H 3 | 4 | ESP8266WebServer server(80); // The Webserver 5 | boolean firstStart = true; // On firststart = true, NTP will try to get a valid time 6 | int AdminTimeOutCounter = 0; // Counter for Disabling the AdminMode 7 | //strDateTime DateTime; // Global DateTime structure, will be refreshed every Second 8 | //WiFiUDP UDPNTPClient; // NTP Client 9 | //unsigned long UnixTimestamp = 0; // GLOBALTIME ( Will be set by NTP) 10 | boolean Refresh = false; // For Main Loop, to refresh things like GPIO / WS2812 11 | //int cNTP_Update = 0; // Counter for Updating the time via NTP 12 | Ticker tkSecond; // Second - Timer for Updating Datetime Structure 13 | boolean AdminEnabled = true; // Enable Admin Mode for a given Time 14 | //byte Minute_Old = 100; // Helpvariable for checking, when a new Minute comes up (for Auto Turn On / Off) 15 | boolean nowifi = false; 16 | 17 | 18 | 19 | struct strConfig { 20 | String ssid; 21 | String password; 22 | byte IP[4]; 23 | byte Netmask[4]; 24 | byte Gateway[4]; 25 | boolean dhcp; 26 | boolean NodeMode; //test node mode as gateway or peer 27 | boolean rst; 28 | 29 | } config; 30 | 31 | 32 | /* 33 | ** 34 | ** CONFIGURATION HANDLING 35 | ** 36 | */ 37 | void Souliss_Node_Start() 38 | { 39 | 40 | // Read Node Mode.. 41 | if (config.NodeMode){ 42 | if(nowifi != 1) { 43 | LOG.println("Gateway Mode"); 44 | // Connect to the WiFi network and get an address from DHCP 45 | SetAsGateway(myvNet_dhcp); // Set this node as gateway for SoulissApp 46 | SetAddressingServer(); 47 | } 48 | else { 49 | LOG.println("No Gateway Mode coz No Wifi"); 50 | } 51 | 52 | } 53 | else { 54 | LOG.println(nowifi); 55 | if(nowifi != 1) { 56 | LOG.println("Peer Mode"); 57 | // This board request an address to the gateway at runtime, no need 58 | // to configure any parameter here. 59 | SetDynamicAddressing(); 60 | GetAddress(); 61 | } 62 | else { 63 | LOG.println("No Peer Mode coz No Wifi"); 64 | } 65 | } 66 | 67 | } 68 | 69 | void check_ESPMode() 70 | { 71 | if (WiFi.status() != WL_CONNECTED);{ 72 | Serial.print("Connecting to AP"); 73 | for (int i=0; i < 10; i++){ 74 | (WiFi.status() != WL_CONNECTED); 75 | delay(1000); 76 | LOG.println("."); 77 | } 78 | } 79 | if (WiFi.status() == WL_CONNECTED) { 80 | LOG.print("Already connect to : "); 81 | LOG.println(WiFi.SSID()); 82 | LOG.println("Admin Time Out"); 83 | AdminTimeOutCounter=0; 84 | WiFi.mode(WIFI_STA); 85 | LOG.println( "STA mode started" ); 86 | LOG.println(WiFi.localIP()); 87 | LOG.println("Souliss update IP Address"); 88 | GetIPAddress(); 89 | delay(500); 90 | nowifi = false; 91 | 92 | } 93 | else 94 | { 95 | LOG.println( "AP mode started coz' No WiFi or No Config" ); 96 | WiFi.mode(WIFI_AP); 97 | WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0)); 98 | WiFi.softAP(ACCESS_POINT_NAME); 99 | LOG.println(WiFi.softAPIP()); 100 | dnsServer.start(DNS_PORT, "*", apIP); 101 | LOG.println(WiFi.softAPIP()); 102 | nowifi = true; 103 | } 104 | 105 | } 106 | 107 | void ConfigureWifi() 108 | { 109 | LOG.println("Configuring Wifi"); 110 | WiFi.begin (config.ssid.c_str(), config.password.c_str()); 111 | check_ESPMode(); 112 | 113 | if (!config.dhcp) 114 | { 115 | WiFi.config(IPAddress(config.IP[0],config.IP[1],config.IP[2],config.IP[3] ), IPAddress(config.Gateway[0],config.Gateway[1],config.Gateway[2],config.Gateway[3] ) , IPAddress(config.Netmask[0],config.Netmask[1],config.Netmask[2],config.Netmask[3] )); 116 | LOG.println("Souliss update IP Address for STATIC"); 117 | GetIPAddress(); 118 | LOG.println(WiFi.localIP()); 119 | } 120 | check_ESPMode(); 121 | } 122 | 123 | void WriteConfig() 124 | { 125 | 126 | LOG.println("Writing Config"); 127 | EEPROM.write(0,'C'); 128 | EEPROM.write(1,'F'); 129 | EEPROM.write(2,'G'); 130 | EEPROM.write(3,config.rst); 131 | 132 | EEPROM.write(16,config.dhcp); 133 | 134 | EEPROM.write(32,config.IP[0]); 135 | EEPROM.write(33,config.IP[1]); 136 | EEPROM.write(34,config.IP[2]); 137 | EEPROM.write(35,config.IP[3]); 138 | 139 | EEPROM.write(36,config.Netmask[0]); 140 | EEPROM.write(37,config.Netmask[1]); 141 | EEPROM.write(38,config.Netmask[2]); 142 | EEPROM.write(39,config.Netmask[3]); 143 | 144 | EEPROM.write(40,config.Gateway[0]); 145 | EEPROM.write(41,config.Gateway[1]); 146 | EEPROM.write(42,config.Gateway[2]); 147 | EEPROM.write(43,config.Gateway[3]); 148 | 149 | EEPROM.write(50,config.NodeMode); 150 | 151 | WriteStringToEEPROM(100,config.ssid); 152 | WriteStringToEEPROM(132,config.password); 153 | 154 | EEPROM.commit(); 155 | 156 | } 157 | boolean ReadConfig() 158 | { 159 | 160 | LOG.println("Reading Configuration"); 161 | if (EEPROM.read(0) == 'C' && EEPROM.read(1) == 'F' && EEPROM.read(2) == 'G' ) 162 | { 163 | LOG.println("Configuration Found!"); 164 | config.rst = EEPROM.read(3); 165 | 166 | config.dhcp = EEPROM.read(16); 167 | 168 | config.IP[0] = EEPROM.read(32); 169 | config.IP[1] = EEPROM.read(33); 170 | config.IP[2] = EEPROM.read(34); 171 | config.IP[3] = EEPROM.read(35); 172 | config.Netmask[0] = EEPROM.read(36); 173 | config.Netmask[1] = EEPROM.read(37); 174 | config.Netmask[2] = EEPROM.read(38); 175 | config.Netmask[3] = EEPROM.read(39); 176 | config.Gateway[0] = EEPROM.read(40); 177 | config.Gateway[1] = EEPROM.read(41); 178 | config.Gateway[2] = EEPROM.read(42); 179 | config.Gateway[3] = EEPROM.read(43); 180 | 181 | config.NodeMode = EEPROM.read(50); 182 | 183 | config.ssid = ReadStringFromEEPROM(100); 184 | config.password = ReadStringFromEEPROM(132); 185 | 186 | return true; 187 | 188 | } 189 | else 190 | { 191 | LOG.println("Configuration NOT FOUND!!!!"); 192 | return false; 193 | } 194 | } 195 | 196 | #endif 197 | 198 | 199 | -------------------------------------------------------------------------------- /SoulissDomo_Device_Example/Souliss_ESP_WebInterface_Simplified/helpers.h: -------------------------------------------------------------------------------- 1 | #ifndef HELPERS_H 2 | #define HELPERS_H 3 | 4 | 5 | 6 | static const uint8_t monthDays[]={31,28,31,30,31,30,31,31,30,31,30,31}; 7 | #define LEAP_YEAR(Y) ( ((1970+Y)>0) && !((1970+Y)%4) && ( ((1970+Y)%100) || !((1970+Y)%400) ) ) 8 | 9 | 10 | struct strDateTime 11 | { 12 | byte hour; 13 | byte minute; 14 | byte second; 15 | int year; 16 | byte month; 17 | byte day; 18 | byte wday; 19 | 20 | } ; 21 | 22 | 23 | 24 | // 25 | // Summertime calculates the daylight saving for a given date. 26 | // 27 | boolean summertime(int year, byte month, byte day, byte hour, byte tzHours) 28 | // input parameters: "normal time" for year, month, day, hour and tzHours (0=UTC, 1=MEZ) 29 | { 30 | if (month<3 || month>10) return false; // keine Sommerzeit in Jan, Feb, Nov, Dez 31 | if (month>3 && month<10) return true; // Sommerzeit in Apr, Mai, Jun, Jul, Aug, Sep 32 | if (month==3 && (hour + 24 * day)>=(1 + tzHours + 24*(31 - (5 * year /4 + 4) % 7)) || month==10 && (hour + 24 * day)<(1 + tzHours + 24*(31 - (5 * year /4 + 1) % 7))) 33 | return true; 34 | else 35 | return false; 36 | } 37 | 38 | // 39 | // Check the Values is between 0-255 40 | // 41 | boolean checkRange(String Value) 42 | { 43 | if (Value.toInt() < 0 || Value.toInt() > 255) 44 | { 45 | return false; 46 | } 47 | else 48 | { 49 | return true; 50 | } 51 | } 52 | 53 | 54 | void WriteStringToEEPROM(int beginaddress, String string) 55 | { 56 | char charBuf[string.length()+1]; 57 | string.toCharArray(charBuf, string.length()+1); 58 | for (int t= 0; t 31) break; 73 | counter++; 74 | retString.concat(rChar); 75 | 76 | } 77 | return retString; 78 | } 79 | void EEPROMWritelong(int address, long value) 80 | { 81 | byte four = (value & 0xFF); 82 | byte three = ((value >> 8) & 0xFF); 83 | byte two = ((value >> 16) & 0xFF); 84 | byte one = ((value >> 24) & 0xFF); 85 | 86 | //Write the 4 bytes into the eeprom memory. 87 | EEPROM.write(address, four); 88 | EEPROM.write(address + 1, three); 89 | EEPROM.write(address + 2, two); 90 | EEPROM.write(address + 3, one); 91 | } 92 | long EEPROMReadlong(long address) 93 | { 94 | //Read the 4 bytes from the eeprom memory. 95 | long four = EEPROM.read(address); 96 | long three = EEPROM.read(address + 1); 97 | long two = EEPROM.read(address + 2); 98 | long one = EEPROM.read(address + 3); 99 | 100 | //Return the recomposed long by using bitshift. 101 | return ((four << 0) & 0xFF) + ((three << 8) & 0xFFFF) + ((two << 16) & 0xFFFFFF) + ((one << 24) & 0xFFFFFFFF); 102 | } 103 | 104 | void ConvertUnixTimeStamp( unsigned long TimeStamp, struct strDateTime* DateTime) 105 | { 106 | uint8_t year; 107 | uint8_t month, monthLength; 108 | uint32_t time; 109 | unsigned long days; 110 | time = (uint32_t)TimeStamp; 111 | DateTime->second = time % 60; 112 | time /= 60; // now it is minutes 113 | DateTime->minute = time % 60; 114 | time /= 60; // now it is hours 115 | DateTime->hour = time % 24; 116 | time /= 24; // now it is days 117 | DateTime->wday = ((time + 4) % 7) + 1; // Sunday is day 1 118 | 119 | year = 0; 120 | days = 0; 121 | while((unsigned)(days += (LEAP_YEAR(year) ? 366 : 365)) <= time) { 122 | year++; 123 | } 124 | DateTime->year = year; // year is offset from 1970 125 | 126 | days -= LEAP_YEAR(year) ? 366 : 365; 127 | time -= days; // now it is days in this year, starting at 0 128 | 129 | days=0; 130 | month=0; 131 | monthLength=0; 132 | for (month=0; month<12; month++) { 133 | if (month==1) { // february 134 | if (LEAP_YEAR(year)) { 135 | monthLength=29; 136 | } else { 137 | monthLength=28; 138 | } 139 | } else { 140 | monthLength = monthDays[month]; 141 | } 142 | 143 | if (time >= monthLength) { 144 | time -= monthLength; 145 | } else { 146 | break; 147 | } 148 | } 149 | DateTime->month = month + 1; // jan is month 1 150 | DateTime->day = time + 1; // day of month 151 | DateTime->year += 1970; 152 | 153 | 154 | } 155 | 156 | 157 | 158 | String GetMacAddress() 159 | { 160 | uint8_t mac[6]; 161 | char macStr[18] = {0}; 162 | WiFi.macAddress(mac); 163 | sprintf(macStr, "%02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); 164 | return String(macStr); 165 | } 166 | 167 | // convert a single hex digit character to its integer value (from https://code.google.com/p/avr-netino/) 168 | unsigned char h2int(char c) 169 | { 170 | if (c >= '0' && c <='9'){ 171 | return((unsigned char)c - '0'); 172 | } 173 | if (c >= 'a' && c <='f'){ 174 | return((unsigned char)c - 'a' + 10); 175 | } 176 | if (c >= 'A' && c <='F'){ 177 | return((unsigned char)c - 'A' + 10); 178 | } 179 | return(0); 180 | } 181 | 182 | String urldecode(String input) // (based on https://code.google.com/p/avr-netino/) 183 | { 184 | char c; 185 | String ret = ""; 186 | 187 | for(byte t=0;t 8 | 9 |

Welcome to Souliss

10 |
11 | 12 |
13 | Click Here to Begin
14 |
15 | 16 | 17 |
Click the check button to Reboot:
18 |
19 |
20 |
21 |

Contact us at http://www.souliss.net/

22 |

Install SoulissApp in Google Play Store to control this node

23 | 24 |
25 |

Present to You by Juan Pinto - Thanks to Dario, Lesjaw, Dom and others..

26 | 27 | 28 | 29 | 48 | 49 | )====="; 50 | #endif 51 | 52 | 53 | void processMain() 54 | { 55 | 56 | if (server.args() > 0 ) // Reboot Settings 57 | { 58 | config.rst = true; 59 | String temp = ""; 60 | for ( uint8_t i = 0; i < server.args(); i++ ) { 61 | if (server.argName(i) == "rst") config.rst = false; 62 | LOG.println(F("EEPROM Clear, Size: ")); 63 | LOG.println(STORE__SIZE); 64 | //Store_Clear(); 65 | for(int i=0;i(PAGE_main)); 75 | Serial.println(__FUNCTION__); 76 | 77 | } 78 | 79 | void send_reset_values_html() 80 | { 81 | String values =""; 82 | values += "rst|" + (String) (config.rst ? "checked" : "") + "|chk\n"; 83 | server.send ( 200, "text/plain", values); 84 | Serial.println(__FUNCTION__); 85 | } 86 | 87 | -------------------------------------------------------------------------------- /SoulissDomo_Device_Example/Souliss_ESP_v4/Page_General.h: -------------------------------------------------------------------------------- 1 | /// 2 | // HTML PAGE 3 | // 4 | 5 | const char PAGE_AdminGeneralSettings[] PROGMEM = R"=====( 6 | 7 | 8 | <  Souliss Slot Settings 9 |
10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 34 | 35 | 36 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 60 | 61 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 |
Node Name
Emoncms APISend Sensors?:
Sensors Configuration: 23 | 33 |
DHT Type: 37 | 41 |
Dallas Qty:
Lights Output Mode: 49 | 59 |
Others: 62 | 77 |
Capacitive Thresold:
Altitude:
Enable IR Receive on this Node?:
Enable this Node as USART Bridge?:
97 | Remember Get Souliss Nodes again from the app after Save Settings 98 |
99 | 100 | 159 | )====="; 160 | 161 | void send_general_html() 162 | { 163 | 164 | if (server.args() > 0 ) // Save Settings 165 | { 166 | byte0 = 0; 167 | byte1 = 0; 168 | byte2 = 0; 169 | String temp = ""; 170 | usartbridge = false; 171 | for ( uint8_t i = 0; i < server.args(); i++ ) { 172 | if (server.argName(i) == "byte0") byte0 = server.arg(i).toInt(); 173 | if (server.argName(i) == "byte1") byte1 = server.arg(i).toInt(); 174 | if (server.argName(i) == "byte2") byte2 = server.arg(i).toInt(); 175 | if (server.argName(i) == "cap_thresold") cap_thresold = server.arg(i).toInt(); 176 | if (server.argName(i) == "Altitude_id") ALTITUDE = server.arg(i).toInt(); 177 | if (server.argName(i) == "usartbridge") usartbridge = true; 178 | if (server.argName(i) == "devicename") DeviceName = urldecode(server.arg(i)); 179 | if (server.argName(i) == "API") API = urldecode(server.arg(i)); 180 | if (server.argName(i) == "Send_Emon") Send_Emon = true; 181 | if (server.argName(i) == "dht_type") dht_type = server.arg(i).toInt(); 182 | if (server.argName(i) == "dallas_qty") dallas_qty = server.arg(i).toInt(); 183 | if (server.argName(i) == "IR_ENABLE") IR_ENABLE = true; 184 | } 185 | WriteConfig_Slots(); 186 | //firstStart = true; 187 | ESP.restart(); 188 | } 189 | server.send ( 200, "text/html", PAGE_AdminGeneralSettings ); 190 | LOG.println(__FUNCTION__); 191 | 192 | 193 | } 194 | 195 | void send_general_configuration_values_html() 196 | { 197 | String values =""; 198 | values += "byte0|" + (String) byte0 + "|input\n"; 199 | values += "byte1|" + (String) byte1 + "|input\n"; 200 | values += "byte2|" + (String) byte2 + "|input\n"; 201 | values += "cap_thresold|" + (String) cap_thresold + "|input\n"; 202 | values += "Altitude_id|" + (String) ALTITUDE + "|input\n"; 203 | values += "usartbridge|" + (String) (usartbridge ? "checked" : "") + "|chk\n"; 204 | values += "devicename|" + (String) DeviceName + "|input\n"; 205 | values += "API|" + (String) API + "|input\n"; 206 | values += "Send_Emon|" + (String) (Send_Emon ? "checked" : "") + "|chk\n"; 207 | values += "dht_type|" + (String) dht_type + "|input\n"; 208 | values += "dallas_qty|" + (String) dallas_qty + "|input\n"; 209 | values += "IR_ENABLE|" + (String) (IR_ENABLE ? "checked" : "") + "|chk\n"; 210 | server.send ( 200, "text/plain", values); 211 | LOG.println(__FUNCTION__); 212 | } 213 | -------------------------------------------------------------------------------- /SoulissDomo_Device_Example/Souliss_ESP_v4/PinsConfig.h: -------------------------------------------------------------------------------- 1 | #ifndef PinsConfig_h 2 | #define PinsConfig_h 3 | 4 | #define PCB 5 | //#define PCBrev2 6 | //#define STRIPBOARD 7 | 8 | //********************** PIN VARIABLES ************************* 9 | byte ALARMP; 10 | byte LEDPWMP0; 11 | byte LEDPWMP1; 12 | byte LEDPWMP2; 13 | byte LEDP; 14 | byte PIRP; 15 | byte LEDRP; 16 | byte LEDGP; 17 | byte LEDBP; 18 | byte CAP0P; 19 | byte CAP1P; 20 | byte THRE; 21 | byte RELAY0P; 22 | byte RELAY1P; 23 | byte SDAP; 24 | byte SCLP; 25 | byte BUT0P; 26 | byte BUT1P; 27 | byte THERM_HEATERP; 28 | byte THERM_FAN1P; 29 | byte THERM_FAN2P; 30 | byte THERM_FAN3P; 31 | 32 | // ************************************************************************** 33 | 34 | // Include and Configure DHT11 SENSOR 35 | #ifdef PCBrev2 //PCB NUEVA REV2 36 | #define DHTPIN 16 // what pin we're connected to 37 | #endif 38 | 39 | #ifdef PCB //PCB NUEVA 40 | #define DHTPIN 4//2//15 // what pin we're connected to 41 | #endif 42 | 43 | #ifdef STRIPBOARD //STRIPBOARD DE PRUEBAS 44 | #define DHTPIN 13 // what pin we're connected to 45 | #endif 46 | 47 | #ifdef PCBrev2 //PCB NUEVA 48 | #define DALLASPIN 14 //Se declara el pin donde se conectará la DATA 49 | #endif 50 | 51 | #ifdef PCB //PCB NUEVA 52 | #define DALLASPIN 14 //Se declara el pin donde se conectará la DATA 53 | #endif 54 | 55 | #ifdef STRIPBOARD //STRIPBOARD DE PRUEBAS 56 | #define DALLASPIN 4 //Se declara el pin donde se conectará la DATA 57 | #endif 58 | 59 | 60 | // ****************************************************************************************************************** 61 | // ************************************************* PINS CONFIG *************************************************** 62 | // ****************************************************************************************************************** 63 | void PINS_CONFIG(){ 64 | 65 | // ************************************************* PINS PCBrev2 *************************************************** 66 | #ifdef PCBrev2 //PCB NUEVA 67 | 68 | if(ONOFF_MODE || PULSE_MODE || PWM_MODE){ 69 | LEDPWMP0 = 13; //LED STRIP ON PIN 70 | LEDPWMP1 = 12; //LED STRIP ON PIN 71 | LEDPWMP2 = 15; //LED STRIP ON PIN 72 | } 73 | if(PIR_MODE){ 74 | LEDPWMP0 = 13;//5; //LED STRIP ON PIN 12 75 | LEDPWMP1 = 12;//16; //LED STRIP ON PIN 13 76 | LEDP = 15; //LED STRIP ON PIN 15 77 | PIRP = 2; //LED STRIP ON PIN 2 78 | } 79 | if(ALARM_MODE){ 80 | ALARMP = 2; 81 | } 82 | 83 | if(RGB_MODE){ 84 | LEDRP = 13;//5; //LED STRIP ON PIN 12 85 | LEDGP = 12;//16; //LED STRIP ON PIN 13 86 | LEDBP = 15; //LED STRIP ON PIN 15 87 | } 88 | 89 | //PIN OPTIONS FOR CAPACITIVE - RELAY OR BMP180 90 | if(CAPACITIVE){ 91 | CAP0P = 4;//12; 92 | CAP1P = 5;//14; 93 | } 94 | 95 | if(RELAY || PULSE_OUTPUT || GARAGE_DOOR || WINDOW_CURTAIN){ 96 | RELAY0P = 4; 97 | RELAY1P = 5; 98 | } 99 | if(BMP180){ 100 | //SDA 5 SCL 4 PINS MUST CHANGE ON WIRE.H 101 | SCLP = 4;//12; 102 | SDAP = 5;//14; 103 | } 104 | if(BUTTONS || BUTTONS_PULLUP || ALARM_ENDSTOP || BUTTONS_2_STATE){ 105 | BUT0P = 4; 106 | BUT1P = 5; 107 | } 108 | if(OPTO_AND_RELAY){ 109 | BUT0P = 4; //Used to OPTO IN 110 | RELAY1P = 5; //Used to Relay 111 | } 112 | 113 | #endif 114 | // ************************************************* PINS PCB *************************************************** 115 | #ifdef PCB //PCB NUEVA 116 | 117 | if(ONOFF_MODE || PULSE_MODE || PWM_MODE){ 118 | LEDPWMP0 = 13; //LED STRIP ON PIN 12 119 | LEDPWMP1 = 12; //LED STRIP ON PIN 13 120 | LEDPWMP2 = 16; //LED STRIP ON PIN 15 121 | } 122 | if(PIR_MODE){ 123 | LEDPWMP0 = 13;//5; //LED STRIP ON PIN 12 124 | LEDPWMP1 = 12;//16; //LED STRIP ON PIN 13 125 | LEDP = 16; //LED STRIP ON PIN 15 126 | PIRP = 0; //LED STRIP ON PIN 2 127 | } 128 | if(ALARM_MODE){ 129 | ALARMP = 0; 130 | } 131 | 132 | if(RGB_MODE){ 133 | LEDRP = 13; //LED STRIP ON PIN 12 134 | LEDGP = 12; //LED STRIP ON PIN 13 135 | LEDBP = 16; //LED STRIP ON PIN 15 136 | } 137 | 138 | //PIN OPTIONS FOR CAPACITIVE - RELAY OR BMP180 139 | if(CAPACITIVE){ 140 | CAP0P = 4; 141 | CAP1P = 5; 142 | } 143 | 144 | if(RELAY || PULSE_OUTPUT || GARAGE_DOOR || WINDOW_CURTAIN){ 145 | RELAY0P = 4;//12; 146 | RELAY1P = 5;//14; 147 | } 148 | if(BMP180){ 149 | //SDA 5 SCL 4 PINS MUST CHANGE ON WIRE.H 150 | SCLP = 4;//12; 151 | SDAP = 5;//14; 152 | } 153 | if(BUTTONS || BUTTONS_PULLUP || ALARM_ENDSTOP || BUTTONS_2_STATE){ 154 | BUT0P = 4; 155 | BUT1P = 5; 156 | } 157 | if(OPTO_AND_RELAY){ 158 | BUT0P = 4; //Used to OPTO IN 159 | RELAY1P = 5; //Used to Relay 160 | } 161 | #endif 162 | // ************************************************* PINS STRIPBOARD *************************************************** 163 | #ifdef STRIPBOARD 164 | 165 | if(ONOFF_MODE || PULSE_MODE || PWM_MODE){ 166 | LEDPWMP0 = 5; //LED STRIP ON PIN 12 167 | LEDPWMP1 = 2; //LED STRIP ON PIN 13 168 | LEDPWMP2 = 15; //LED STRIP ON PIN 15 169 | } 170 | 171 | if(PIR_MODE){ 172 | LEDPWMP0 = 5; //LED STRIP ON PIN 12 173 | LEDPWMP1 = 2;//16; //LED STRIP ON PIN 13 174 | LEDP = 15; //LED STRIP ON PIN 15 175 | PIRP = 16;//2; //LED STRIP ON PIN 2 176 | } 177 | if(ALARM_MODE){ 178 | ALARMP = 16;//2; 179 | } 180 | 181 | if(RGB_MODE){ 182 | LEDRP = 5; //LED STRIP ON PIN 12 183 | LEDGP = 2;//16; //LED STRIP ON PIN 13 184 | LEDBP = 15; //LED STRIP ON PIN 15 185 | } 186 | if(THERMOSTAT_MODE){ 187 | THERM_HEATERP = 5; 188 | THERM_FAN1P = 2; 189 | THERM_FAN2P = 15; 190 | THERM_FAN3P = 13; //USING DHT PIN FOR TESTING PURPOSES 191 | } 192 | 193 | //PIN OPTIONS FOR CAPACITIVE - RELAY OR BMP180 194 | if(CAPACITIVE){ 195 | //SDA 5 SCL 4 PINS MUST CHANGE ON WIRE.H 196 | CAP0P = 12; 197 | CAP1P = 14; 198 | } 199 | 200 | if(RELAY || PULSE_OUTPUT || GARAGE_DOOR || WINDOW_CURTAIN){ 201 | RELAY0P = 12; 202 | RELAY1P = 14; 203 | } 204 | if(BMP180){ 205 | SCLP = 12; 206 | SDAP = 14; 207 | } 208 | if(BUTTONS || BUTTONS_PULLUP || ALARM_ENDSTOP || BUTTONS_2_STATE){ 209 | BUT0P = 12; 210 | BUT1P = 14; 211 | } 212 | if(OPTO_AND_RELAY){ 213 | BUT0P = 12; //Used to OPTO IN 214 | RELAY1P = 14; //Used to Relay 215 | } 216 | #endif 217 | 218 | } 219 | 220 | #endif 221 | -------------------------------------------------------------------------------- /SoulissDomo_Device_Example/Souliss_ESP_v4/Souliss_ESP_v4.cpp.generic.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpintom/Souliss_ESP_Examples/f1eb10cb5757ab4166bf92796a4896bfa5f36238/SoulissDomo_Device_Example/Souliss_ESP_v4/Souliss_ESP_v4.cpp.generic.bin -------------------------------------------------------------------------------- /SoulissDomo_Device_Example/Souliss_ESP_v4/Souliss_ESP_v4.ino: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | Souliss - Web Configuration 3 | 4 | This example demonstrate a complete web configuration of ESP8266 based 5 | nodes, the node starts as access point and allow though a web interface 6 | the configuration of IP and Souliss parameters. 7 | 8 | This example is only supported on ESP8266. 9 | 10 | ***************************************************************************/ 11 | 12 | #define SERIALPORT_INSKETCH 13 | #define LOG Serial 14 | 15 | // ************************* IR LIBRARY *********************************** 16 | // To use the IR Functions you need to add this library to your Arduino libraries: 17 | // https://github.com/markszabo/IRremoteESP8266/ 18 | 19 | #include 20 | 21 | // ************************* SOULISS DEBUG LINES *********************************** 22 | // Enable or disable Souliss debug 23 | #define MaCaco_DEBUG_INSKETCH 24 | #define MaCaco_DEBUG 1 25 | 26 | #define VNET_DEBUG_INSKETCH 27 | #define VNET_DEBUG 1 28 | 29 | #define SOULISS_DEBUG_INSKETCH 30 | #define SOULISS_DEBUG 1 31 | 32 | /*#define USART_LOG LOG.print 33 | #define USART_DEBUG_INSKETCH 34 | #define USART_DEBUG 1 35 | 36 | #define USARTBAUDRATE_INSKETCH 37 | # define USART_BAUD9k6 1 38 | # define USART_BAUD19k2 0 39 | # define USART_BAUD57k6 0 40 | # define USART_BAUD115k2 0 41 | # define USART_BAUD256k 0 */ 42 | // ************* 43 | 44 | // *************************** SENSORS LIBRARIES ************************* 45 | 46 | #include "DHT.h" 47 | #include 48 | #include 49 | #include 50 | #include 51 | 52 | // *************************** ESP LIBRARIES *************************** 53 | 54 | #include 55 | #include 56 | #include 57 | #include 58 | #include 59 | #include 60 | 61 | // *************************** SOULISS LIBRARIES *************************** 62 | // Configure the Souliss framework 63 | #include "bconf/MCU_ESP8266.h" // Load the code directly on the ESP8266 64 | //#include "conf/SuperNode.h" 65 | //#include "conf/usart.h" // USART 66 | #include "conf/RuntimeGateway.h" // This node is a Peer and can became a Gateway at runtime 67 | #include "conf/DynamicAddressing.h" // Use dynamically assigned addresses 68 | #include "conf/WEBCONFinterface.h" // Enable the WebConfig interface 69 | 70 | #include "Souliss.h" 71 | #include "Functions.h" 72 | #include "irReceiver.h" 73 | #include "irButtons.h" 74 | #include "SetupAndLoop.h" 75 | 76 | #include "Page_General.h" 77 | 78 | //OTA_Setup(); 79 | ESP8266HTTPUpdateServer httpUpdater; 80 | 81 | /*#include "Adafruit_IO_Client.h" 82 | //#define AIO_KEY "...your Adafruit IO key value ..." 83 | #define AIO_KEY "65b1e1717e6d08e3f58768c1de502d5363d6a64e" 84 | Adafruit_IO_Client aio = Adafruit_IO_Client(client, AIO_KEY); 85 | Adafruit_IO_Feed testFeed = aio.getFeed("esptestfeed"); 86 | unsigned int count = 0; 87 | */ 88 | void setup() 89 | { 90 | LOG.begin(115200); 91 | if(IR_ENABLE){ 92 | irrecv.enableIRIn(); // Start the receiver 93 | } 94 | 95 | Initialize(); 96 | // **** FUNCTION TO DELETE JUST ADDRESSES (MORE THAN 5sec) or ALL THE EEPROM DATA (MORE THAN 10sec) *** 97 | // STILL DISABLED, TESTING 98 | EEPROM.begin(512); 99 | LOG.println(""); 100 | LOG.println("Time to Reset"); 101 | delay(1000); 102 | long previous = millis(); 103 | pinMode(0, INPUT); 104 | if(!digitalRead(0)) LOG.println("GPIO0 PRESSED!"); 105 | while(!digitalRead(0)){ 106 | if(millis() < previous + 5000){ 107 | LOG.print("Deleting Addresses in: "); 108 | LOG.println(5000 - (millis() - previous)); 109 | delay(500); 110 | }else{ 111 | for(int i = STORE__ADDR_s; i <= STORE__PADDR_f; i++){ 112 | //EEPROM.write(i,0); 113 | } 114 | EEPROM.commit(); 115 | LOG.println("Address Deleted"); 116 | // DELETE EEPROM IF GPIO STILL PRESSED 117 | if(millis() < previous + 10000){ 118 | LOG.print("Deleting EEPROM in: "); 119 | LOG.println(10000 - (millis() - previous)); 120 | delay(500); 121 | }else{ 122 | for(int i = 0; i <= 512; i++){ 123 | EEPROM.write(i,255); 124 | } 125 | EEPROM.commit(); 126 | LOG.println("EEPROM Deleted"); 127 | } 128 | } 129 | } 130 | 131 | //SetAddress(0xAB04,0x00FF,0xAB01); 132 | server.on ( "/", send_general_html ); 133 | server.on ( "/general.html", send_general_html ); 134 | server.on ( "/admin/generalvalues", send_general_configuration_values_html); 135 | 136 | // Read the IP configuration from the EEPROM, if not available start 137 | // the node as access point 138 | if(!ReadIPConfiguration()) 139 | { 140 | // Start the node as access point with a configuration WebServer 141 | SetAccessPoint(); 142 | startWebServer(); 143 | 144 | // We have nothing more than the WebServer for the configuration 145 | // to run, once configured the node will quit this. 146 | while(1) 147 | { 148 | yield(); 149 | runWebServer(); 150 | } 151 | 152 | } 153 | ReadConfig_Slots(); 154 | if(DEBUG_PRESSURE){ 155 | LOG.print("ALTITUD: "); 156 | LOG.println(ALTITUDE); 157 | } 158 | 159 | 160 | LOG.print("EEPROM GW: "); 161 | LOG.println(EEPROM.read(STORE__GATEWAY_s)); 162 | 163 | if (IsRuntimeGateway()) 164 | { 165 | // Connect to the WiFi network and get an address from DHCP 166 | LOG.println("Gateway Mode"); 167 | SetAsGateway(myvNet_dhcp); // Set this node as gateway for SoulissApp 168 | SetAddressingServer(); 169 | 170 | } 171 | else 172 | { 173 | // This board request an address to the gateway at runtime, no need 174 | // to configure any parameter here. 175 | LOG.println("Peer Mode"); 176 | SetDynamicAddressing(); 177 | GetAddress(); 178 | 179 | } 180 | setupGeneral(); 181 | startWebServer(); 182 | LOG.print("vNet Media : "); 183 | LOG.println (vNet_GetAddress(vNet_MyMedia()),HEX); 184 | LOG.print("vNet 1 : "); 185 | LOG.print(vNet_GetAddress(1),HEX); 186 | LOG.print(" | IP: "); 187 | LOG.println(vNet_GetAddress(1),DEC); 188 | LOG.print("vNet 2 : "); 189 | LOG.println (vNet_GetAddress(2),HEX); 190 | LOG.print("vNet 3 : "); 191 | LOG.println (vNet_GetAddress(3),HEX); 192 | LOG.print("vNet 4 : "); 193 | LOG.println (vNet_GetAddress(4),HEX); 194 | LOG.print("vNet 5 : "); 195 | LOG.println (vNet_GetAddress(5),HEX); 196 | 197 | LOG.print("STORE__SIZE: "); 198 | LOG.println(STORE__SIZE); 199 | //OTA_Init(); 200 | 201 | httpUpdater.setup(&server); 202 | MDNS.addService("http", "tcp", 80); 203 | 204 | //aio.begin(); 205 | } 206 | 207 | 208 | 209 | void loop() 210 | { 211 | if(IR_ENABLE){ 212 | readIR(); 213 | } 214 | runWebServer(); 215 | 216 | EXECUTEFAST() { 217 | UPDATEFAST(); 218 | 219 | fastGeneral(); 220 | 221 | // Run communication as Gateway or Peer 222 | if (IsRuntimeGateway()) 223 | FAST_GatewayComms(); 224 | else 225 | FAST_PeerComms(); 226 | } 227 | 228 | EXECUTESLOW() { 229 | UPDATESLOW(); 230 | /*SLOW_x10s(1) { 231 | count += 1; 232 | if (testFeed.send(count)) { 233 | LOG.print(F("Wrote value to feed: ")); LOG.println(count, DEC); 234 | } 235 | else { 236 | LOG.println(F("Error writing value to feed!")); 237 | } 238 | } 239 | SLOW_x10s(3){ 240 | FeedData latest = testFeed.receive(); 241 | if (latest.isValid()) { 242 | Serial.print(F("Received value from feed: ")); Serial.println(latest); 243 | // By default the received feed data item has a string value, however you 244 | // can use the following functions to attempt to convert it to a numeric 245 | // value like an int or float. Each function returns a boolean that indicates 246 | // if the conversion succeeded, and takes as a parameter by reference the 247 | // output value. 248 | int i; 249 | if (latest.intValue(&i)) { 250 | Serial.print(F("Value as an int: ")); Serial.println(i, DEC); 251 | } 252 | // Other functions that you can use include: 253 | // latest.uintValue() (unsigned int) 254 | // latest.longValue() (long) 255 | // latest.ulongValue() (unsigned long) 256 | // latest.floatValue() (float) 257 | // latest.doubleValue() (double) 258 | } 259 | else { 260 | Serial.print(F("Failed to receive the latest feed value!")); 261 | } 262 | } */ 263 | slowGeneral(); 264 | 265 | // If running as Peer 266 | if (!IsRuntimeGateway()) 267 | SLOW_PeerJoin(); 268 | } 269 | //OTA_Process(); 270 | } 271 | 272 | 273 | 274 | -------------------------------------------------------------------------------- /SoulissDomo_Device_Example/Souliss_ESP_v4/Souliss_ESP_v4.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpintom/Souliss_ESP_Examples/f1eb10cb5757ab4166bf92796a4896bfa5f36238/SoulissDomo_Device_Example/Souliss_ESP_v4/Souliss_ESP_v4.zip -------------------------------------------------------------------------------- /SoulissDomo_Device_Example/Souliss_ESP_v4/Souliss_ESP_v4_rev2_dht22.cpp.generic.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpintom/Souliss_ESP_Examples/f1eb10cb5757ab4166bf92796a4896bfa5f36238/SoulissDomo_Device_Example/Souliss_ESP_v4/Souliss_ESP_v4_rev2_dht22.cpp.generic.bin -------------------------------------------------------------------------------- /SoulissDomo_Device_Example/Souliss_ESP_v4/irButtons.h: -------------------------------------------------------------------------------- 1 | #ifndef irButtons_h 2 | #define irButtons_h 3 | 4 | 5 | /******************************** BUTTONS DEFINITIONS *************************/ 6 | //This values are long values returned by IRremote library, to get your values enable DEBUG and see results on Serial Port 7 | #define b0 16748655 8 | #define b1 16758855 9 | #define b2 16775175 10 | #define b3 16756815 11 | #define b4 16750695 12 | #define b5 16767015 13 | #define b6 16746615 14 | #define b7 16754775 15 | #define b8 16771095 16 | #define b9 16730295 17 | #define b10 16738455 18 | #define b11 16757325 19 | #define b12 16712445 20 | #define b13 16724685 21 | #define b14 16720095 22 | #define b15 16711935 23 | #define b16 16732335 24 | #define b17 16742535 25 | #define b18 16740495 26 | #define b19 16734375 27 | #define b20 16726215 28 | #define b21 16722135 29 | #define b22 16773135 30 | #define b23 16724175 31 | #define b_Repeat 4294967295 32 | 33 | /************************************* COLORES ************************/ 34 | #define Rojo 0xFF,0x00,0x00 35 | #define Verde 0x00,0xFF,0x00 36 | #define Azul 0x00,0x00,0xFF 37 | #define Naranja 0xFF,0x5F,0x00 38 | #define Amarillo 0xFF,0xFF,0x00 39 | #define AzulCielo 0x00,0xFF,0xFF 40 | #define AzulOscuro 0x00,0x5F,0xFF 41 | #define Morado 0xFF,0x00,0xFF 42 | #define MoradoSuave 0xFF,0x5F,0xFF 43 | #define Blanco 0xFF,0xFF,0xFF 44 | 45 | // ************************** COLORS FOR setBrightColor FUNCTION ******************* 46 | #define Red 1 47 | #define Green 2 48 | #define Blue 3 49 | 50 | // ********************************** FUNCTION CODES **************************** 51 | #define ir_ONOFF 1 52 | #define ir_PWM 2 53 | #define ir_RGB 3 54 | 55 | byte remote_mode = 0; 56 | 57 | /*********************** BUTTON ASSIGNATION COLORS CALL FUNCTION *********************/ 58 | void irButtons(byte function){ 59 | 60 | // ************************************************************************* 61 | // *************************** ir_ONOFF MODE ******************************* 62 | // ************************************************************************* 63 | if(function == ir_ONOFF || function == ir_PWM){ 64 | // ************************ OFF ALL ***************************** 65 | if(Souliss_IrIn(b2, 0, 254, &results)){ 66 | mInput(LEDPWM0) = Souliss_T1n_OffCmd; 67 | mInput(LEDPWM1) = Souliss_T1n_OffCmd; 68 | mInput(LEDPWM2) = Souliss_T1n_OffCmd; 69 | } 70 | // ************************ ON ALL ******************************* 71 | if(Souliss_IrIn(b3, 0, 254, &results)){ 72 | 73 | mInput(LEDPWM0) = Souliss_T1n_OnCmd; 74 | mInput(LEDPWM1) = Souliss_T1n_OnCmd; 75 | mInput(LEDPWM2) = Souliss_T1n_OnCmd; 76 | } 77 | // ************************ TOGGLES ******************************* 78 | Souliss_IrIn(b11, Souliss_T1n_ToggleCmd, LEDPWM0, &results); 79 | Souliss_IrIn(b15, Souliss_T1n_ToggleCmd, LEDPWM1, &results); 80 | Souliss_IrIn(b19, Souliss_T1n_ToggleCmd, LEDPWM2, &results); 81 | 82 | // ************************ TIMERS ******************************* 83 | Souliss_IrIn(b10, Souliss_T1n_Timed_StdVal, LEDPWM0, &results); 84 | Souliss_IrIn(b14, Souliss_T1n_Timed_StdVal, LEDPWM1, &results); 85 | Souliss_IrIn(b18, Souliss_T1n_Timed_StdVal, LEDPWM2, &results); 86 | 87 | } 88 | // ************************************************************************* 89 | // ************************************************************************* 90 | 91 | // ************************************************************************* 92 | // ***************************** ir_PWM MODE ******************************* 93 | // ************************************************************************* 94 | if(function == ir_PWM){ 95 | // ********************************************************************* 96 | // ************** BRIGHT UP - DOWN MODE BUTTONS ****************** 97 | // ********************************************************************* 98 | // ************************ SELECT MODE ************************** 99 | if(Souliss_IrIn(b23, 0, 0, &results)) 100 | { 101 | if (remote_mode < 3 ) remote_mode++; 102 | else remote_mode=0; 103 | if(DEBUG_IR){ LOG.print("Remote Mode: "); LOG.println(remote_mode); } 104 | } 105 | // ******************* BRIGHT CONTROL ******************************* 106 | switch (remote_mode) { 107 | case 0: 108 | Souliss_IrIn(b0, Souliss_T1n_BrightUp, LEDPWM0, &results); 109 | Souliss_IrIn(b1, Souliss_T1n_BrightDown, LEDPWM0, &results); 110 | break; 111 | case 1: 112 | Souliss_IrIn(b0, Souliss_T1n_BrightUp, LEDPWM1, &results); 113 | Souliss_IrIn(b1, Souliss_T1n_BrightDown, LEDPWM1, &results); 114 | break; 115 | case 2: 116 | Souliss_IrIn(b0, Souliss_T1n_BrightUp, LEDPWM2, &results); 117 | Souliss_IrIn(b1, Souliss_T1n_BrightDown, LEDPWM2, &results); 118 | break; 119 | case 3: 120 | // ************************ BRIGHT UP ALL ************************ 121 | if(Souliss_IrIn(b0, 0, 254, &results)){ 122 | mInput(LEDPWM0) = Souliss_T1n_BrightUp; 123 | mInput(LEDPWM1) = Souliss_T1n_BrightUp; 124 | mInput(LEDPWM2) = Souliss_T1n_BrightUp; 125 | } 126 | // ********************** BRIGHT DOWN ALL ************************ 127 | if(Souliss_IrIn(b1, 0, 254, &results)){ 128 | mInput(LEDPWM0) = Souliss_T1n_BrightDown; 129 | mInput(LEDPWM1) = Souliss_T1n_BrightDown; 130 | mInput(LEDPWM2) = Souliss_T1n_BrightDown; 131 | } 132 | break; 133 | } 134 | 135 | // ********************************************************************* 136 | // ******** BRIGHT UP - DOWN INDIVIDUAL BUTTONS ****************** 137 | // ********************************************************************* 138 | 139 | 140 | // ************************ BRIGHT UP ALL ************************ 141 | if(Souliss_IrIn(b4, 0, 254, &results)){ 142 | mInput(LEDPWM0) = Souliss_T1n_BrightUp; 143 | mInput(LEDPWM1) = Souliss_T1n_BrightUp; 144 | mInput(LEDPWM2) = Souliss_T1n_BrightUp; 145 | } 146 | // ********************** BRIGHT DOWN ALL ************************ 147 | if(Souliss_IrIn(b1, 0, 254, &results)){ 148 | mInput(LEDPWM0) = Souliss_T1n_BrightDown; 149 | mInput(LEDPWM1) = Souliss_T1n_BrightDown; 150 | mInput(LEDPWM2) = Souliss_T1n_BrightDown; 151 | } 152 | // ***************** BRIGHT UP - DOWN BUTTONS ************************ 153 | Souliss_IrIn(b8, Souliss_T1n_BrightUp, LEDPWM0, &results); 154 | Souliss_IrIn(b9, Souliss_T1n_BrightDown, LEDPWM0, &results); 155 | Souliss_IrIn(b12, Souliss_T1n_BrightUp, LEDPWM1, &results); 156 | Souliss_IrIn(b13, Souliss_T1n_BrightDown, LEDPWM1, &results); 157 | Souliss_IrIn(b16, Souliss_T1n_BrightUp, LEDPWM2, &results); 158 | Souliss_IrIn(b17, Souliss_T1n_BrightDown, LEDPWM2, &results); 159 | } 160 | // ************************************************************************* 161 | // ************************************************************************* 162 | 163 | // ************************************************************************* 164 | // ***************************** ir_RGB MODE ******************************* 165 | // ************************************************************************* 166 | 167 | if(function == ir_RGB){ 168 | // *********** COLORES ************** 169 | /* 170 | #define Rojo 0xFF,0x00,0x00 171 | #define Verde 0x00,0xFF,0x00 172 | #define Azul 0x00,0x00,0xFF 173 | #define Naranja 0xFF,0x5F,0x00 174 | #define Amarillo 0xFF,0xFF,0x00 175 | #define AzulCielo 0x00,0xFF,0xFF 176 | #define AzulOscuro 0x00,0x5F,0xFF 177 | #define Morado 0xFF,0x00,0xFF 178 | #define MoradoSuave 0xFF,0x5F,0xFF 179 | #define Blanco 0xFF,0xFF,0xFF 180 | */ 181 | Souliss_IrIn(b0, Souliss_T1n_BrightUp, LEDRGB, &results); 182 | Souliss_IrIn(b1, Souliss_T1n_BrightDown, LEDRGB, &results); 183 | 184 | if(Souliss_IrIn(b23, 0, 0, &results)) 185 | { 186 | if (remote_mode == 0) remote_mode=1; 187 | else remote_mode=0; 188 | } 189 | 190 | if(Souliss_IrIn(b16, 0, LEDRGB, &results)) 191 | { 192 | if (remote_mode == 0 ) setColor(LEDRGB, Naranja); 193 | else setBrightColor(LEDRGB, Red, Souliss_T1n_BrightUp); 194 | } 195 | if(Souliss_IrIn(b17, 0, LEDRGB, &results)) 196 | { 197 | if (remote_mode == 0) setColor(LEDRGB, Azul); 198 | else setBrightColor(LEDRGB, Green, Souliss_T1n_BrightUp); 199 | } 200 | if(Souliss_IrIn(b18, 0, LEDRGB, &results)) 201 | { 202 | if (remote_mode == 0 ) setColor(LEDRGB, Morado); 203 | else setBrightColor(LEDRGB, Blue, Souliss_T1n_BrightUp); 204 | } 205 | if(Souliss_IrIn(b20, 0, LEDRGB, &results)) 206 | { 207 | if (remote_mode == 0 ) setColor(LEDRGB, Amarillo); 208 | else setBrightColor(LEDRGB, Red, Souliss_T1n_BrightDown); 209 | } 210 | if(Souliss_IrIn(b21, 0, LEDRGB, &results)) 211 | { 212 | if (remote_mode == 0 ) setColor(LEDRGB, Blanco); 213 | else setBrightColor(LEDRGB, Green, Souliss_T1n_BrightDown); 214 | 215 | } 216 | if(Souliss_IrIn(b22, 0, LEDRGB, &results)) 217 | { 218 | if (remote_mode == 0 ) setColor(LEDRGB, MoradoSuave); 219 | else setBrightColor(LEDRGB, Blue, Souliss_T1n_BrightDown); 220 | } 221 | } 222 | // ************************************************************************* 223 | // ************************************************************************* 224 | 225 | } 226 | 227 | #endif 228 | 229 | -------------------------------------------------------------------------------- /SoulissDomo_Device_Example/Souliss_ESP_v4/irReceiver.h: -------------------------------------------------------------------------------- 1 | #ifndef irReceiver_h 2 | #define irReceiver_h 3 | 4 | int RECV_PIN = 2; //an IR detector/demodulatord is connected to GPIO pin 2 5 | IRrecv irrecv(RECV_PIN); 6 | decode_results results; 7 | 8 | bool Souliss_IrIn(long remote_button, uint8_t value_state1, uint8_t slot, decode_results *results) { 9 | 10 | if (results->value == remote_button) 11 | { 12 | if(DEBUG_IR) { LOG.print("Souliss_IrIN| Code: "); LOG.print(remote_button); LOG.print(" Cmd: "); LOG.print(value_state1); LOG.print(" Slot: "); LOG.println(slot); } 13 | if(slot != 254) mInput(slot) = value_state1; 14 | results->value = 0; 15 | return true; 16 | } 17 | else return false; 18 | } 19 | 20 | //+============================================================================= 21 | // Display IR code 22 | // 23 | void ircode (decode_results *results) 24 | { 25 | // Panasonic has an Address 26 | if (results->decode_type == PANASONIC) { 27 | LOG.print(results->panasonicAddress, HEX); 28 | LOG.print(":"); 29 | } 30 | 31 | // Print Code 32 | LOG.print(results->value, HEX); 33 | } 34 | 35 | void ircodeDEC (decode_results *results) 36 | { 37 | 38 | LOG.print(results->value, DEC); 39 | 40 | } 41 | 42 | //+============================================================================= 43 | // Display encoding type 44 | // 45 | void encoding (decode_results *results) 46 | { 47 | switch (results->decode_type) { 48 | default: 49 | case UNKNOWN: LOG.print("UNKNOWN"); break ; 50 | case NEC: LOG.print("NEC"); break ; 51 | case SONY: LOG.print("SONY"); break ; 52 | case RC5: LOG.print("RC5"); break ; 53 | case RC6: LOG.print("RC6"); break ; 54 | case DISH: LOG.print("DISH"); break ; 55 | case SHARP: LOG.print("SHARP"); break ; 56 | case JVC: LOG.print("JVC"); break ; 57 | case SANYO: LOG.print("SANYO"); break ; 58 | case MITSUBISHI: LOG.print("MITSUBISHI"); break ; 59 | case SAMSUNG: LOG.print("SAMSUNG"); break ; 60 | case LG: LOG.print("LG"); break ; 61 | case WHYNTER: LOG.print("WHYNTER"); break ; 62 | case AIWA_RC_T501: LOG.print("AIWA_RC_T501"); break ; 63 | case PANASONIC: LOG.print("PANASONIC"); break ; 64 | } 65 | } 66 | 67 | //+============================================================================= 68 | // Dump out the decode_results structure. 69 | // 70 | void dumpInfo (decode_results *results) 71 | { 72 | // Show Encoding standard 73 | LOG.print("Encoding : "); 74 | encoding(results); 75 | LOG.println(""); 76 | 77 | // Show Code & length 78 | LOG.print("Code : "); 79 | ircode(results); 80 | LOG.print(" ("); 81 | LOG.print(results->bits, DEC); 82 | LOG.println(" bits)"); 83 | } 84 | 85 | //+============================================================================= 86 | // Dump out the decode_results structure. 87 | // 88 | void dumpRaw (decode_results *results) 89 | { 90 | // Print Raw data 91 | LOG.print("Timing["); 92 | LOG.print(results->rawlen-1, DEC); 93 | LOG.println("]: "); 94 | 95 | for (int i = 1; i < results->rawlen; i++) { 96 | unsigned long x = results->rawbuf[i] * USECPERTICK; 97 | if (!(i & 1)) { // even 98 | LOG.print("-"); 99 | if (x < 1000) LOG.print(" ") ; 100 | if (x < 100) LOG.print(" ") ; 101 | LOG.print(x, DEC); 102 | } else { // odd 103 | LOG.print(" "); 104 | LOG.print("+"); 105 | if (x < 1000) LOG.print(" ") ; 106 | if (x < 100) LOG.print(" ") ; 107 | LOG.print(x, DEC); 108 | if (i < results->rawlen-1) LOG.print(", "); //',' not needed for last one 109 | } 110 | if (!(i % 8)) LOG.println(""); 111 | } 112 | LOG.println(""); // Newline 113 | } 114 | 115 | //+============================================================================= 116 | // Dump out the decode_results structure. 117 | // 118 | void dumpCode (decode_results *results) 119 | { 120 | // Start declaration 121 | LOG.print("unsigned int "); // variable type 122 | LOG.print("rawData["); // array name 123 | LOG.print(results->rawlen - 1, DEC); // array size 124 | LOG.print("] = {"); // Start declaration 125 | 126 | // Dump data 127 | for (int i = 1; i < results->rawlen; i++) { 128 | LOG.print(results->rawbuf[i] * USECPERTICK, DEC); 129 | if ( i < results->rawlen-1 ) LOG.print(","); // ',' not needed on last one 130 | if (!(i & 1)) LOG.print(" "); 131 | } 132 | 133 | // End declaration 134 | LOG.print("};"); // 135 | 136 | // Comment 137 | LOG.print(" // "); 138 | encoding(results); 139 | LOG.print(" "); 140 | ircode(results); 141 | 142 | // Newline 143 | LOG.println(""); 144 | 145 | // Now dump "known" codes 146 | if (results->decode_type != UNKNOWN) { 147 | 148 | // Some protocols have an address 149 | if (results->decode_type == PANASONIC) { 150 | LOG.print("unsigned int addr = 0x"); 151 | LOG.print(results->panasonicAddress, HEX); 152 | LOG.println(";"); 153 | } 154 | 155 | // All protocols have data 156 | LOG.print("unsigned int data = 0x"); 157 | LOG.print(results->value, HEX); 158 | LOG.println(";"); 159 | } 160 | } 161 | 162 | void readIR(){ 163 | if (irrecv.decode(&results)) { // Grab an IR code 164 | if(DEBUG_IR){ 165 | LOG.print(F("Code: ")); 166 | ircodeDEC(&results); 167 | LOG.println(""); 168 | if(DEBUG_IR_FULL){ 169 | dumpInfo(&results); // Output the results 170 | dumpRaw(&results); // Output the results in RAW format 171 | dumpCode(&results); // Output the results as source code 172 | LOG.println(""); 173 | } 174 | // Blank line between entries 175 | } 176 | irrecv.resume(); // Prepare for the next value 177 | } 178 | } 179 | 180 | #endif 181 | -------------------------------------------------------------------------------- /SoulissDomo_Device_Example/Souliss_ESPv3_5/Functions.h: -------------------------------------------------------------------------------- 1 | 2 | //************************* PINS CONFIGURATION FUNCTION ************************ 3 | void PINS_CONFIG(){ 4 | //if(DHT_SENSOR) 5 | //DHTPIN = 16; // what pin we're connected to 6 | 7 | if(PWM_MODE){ 8 | LEDPWMP0 = 12;//5; //LED STRIP ON PIN 12 9 | LEDPWMP1 = 13;//16; //LED STRIP ON PIN 13 10 | LEDPWMP2 = 15; //LED STRIP ON PIN 15 11 | } 12 | 13 | if(PIR_MODE){ 14 | LEDPWMP0 = 12;//5; //LED STRIP ON PIN 12 15 | LEDPWMP1 = 13;//16; //LED STRIP ON PIN 13 16 | LEDP = 15; //LED STRIP ON PIN 15 17 | PIRP = 2; //LED STRIP ON PIN 2 18 | } 19 | 20 | if(RGB_MODE){ 21 | LEDRP = 12;//5; //LED STRIP ON PIN 12 22 | LEDGP = 13;//16; //LED STRIP ON PIN 13 23 | LEDBP = 15; //LED STRIP ON PIN 15 24 | } 25 | 26 | //PIN OPTIONS FOR CAPACITIVE - RELAY OR BMP180 27 | if(CAPACITIVE){ 28 | //SDA 5 SCL 4 PINS 29 | CAP0P = 4;//12; 30 | CAP1P = 5;//14; 31 | } 32 | 33 | if(RELAY){ 34 | RELAY0P = 4;//12; 35 | RELAY1P = 5;//14; 36 | } 37 | 38 | } 39 | 40 | void SLOT_CONFIG(){ 41 | int NEXTSLOT = 0; 42 | LOG.println("SLOT CONFIG"); 43 | 44 | if(DHT_SENSOR){ 45 | TEMPERATURE = NEXTSLOT; 46 | HUMIDITY = NEXTSLOT + 2; 47 | NEXTSLOT = HUMIDITY + 2; 48 | LOG.print("TEMP: "); 49 | LOG.println(TEMPERATURE); 50 | LOG.print("HUMI: "); 51 | LOG.println(HUMIDITY); 52 | } 53 | 54 | if(PWM_MODE || PIR_MODE){ 55 | LEDPWM0 = NEXTSLOT; 56 | LEDPWM1 = NEXTSLOT + 2; 57 | NEXTSLOT = LEDPWM1 + 2; 58 | LOG.print("LEDPWM0: "); 59 | LOG.println(LEDPWM0); 60 | LOG.print("LEDPWM1: "); 61 | LOG.println(LEDPWM1); 62 | } 63 | if(PWM_MODE){ 64 | LEDPWM2 = NEXTSLOT; 65 | NEXTSLOT = LEDPWM2 + 2; 66 | LOG.print("LEDPWM2: "); 67 | LOG.println(LEDPWM2); 68 | } 69 | 70 | if(PIR_MODE){ 71 | LED = NEXTSLOT; 72 | NEXTSLOT = LED + 1; 73 | LOG.print("LED: "); 74 | LOG.println(LED); 75 | } 76 | 77 | if(RGB_MODE){ 78 | LEDRGB = NEXTSLOT; 79 | NEXTSLOT = LEDRGB + 4; 80 | LOG.print("LEDRGB: "); 81 | LOG.println(LEDRGB); 82 | } 83 | 84 | if(LDR_SENSOR){ 85 | LDR = NEXTSLOT; 86 | NEXTSLOT = LDR + 2; 87 | LOG.print("LDR: "); 88 | LOG.println(LDR); 89 | } 90 | 91 | if(DALLAS_SENSOR){ 92 | DALLAS = NEXTSLOT; 93 | NEXTSLOT = DALLAS + 2; 94 | LOG.print("DALLAS: "); 95 | LOG.println(DALLAS); 96 | } 97 | 98 | //GPIO 4-5 SLOT DEFINITIONS 99 | 100 | if(CAPACITIVE && DEBUG_CAPSENSE){ 101 | CAP0 = NEXTSLOT; 102 | CAP1 = NEXTSLOT + 2; 103 | THRE = NEXTSLOT + 4; 104 | NEXTSLOT = THRE + 2; 105 | LOG.print("CAP0: "); 106 | LOG.println(CAP0); 107 | LOG.print("CAP1: "); 108 | LOG.println(CAP1); 109 | LOG.print("THRE: "); 110 | LOG.println(THRE); 111 | } 112 | 113 | if(RELAY){ 114 | RELAY0 = NEXTSLOT; 115 | RELAY1 = NEXTSLOT + 1; 116 | NEXTSLOT = RELAY1 + 1; 117 | LOG.print("RELAY0: "); 118 | LOG.println(RELAY0); 119 | LOG.print("RELAY1: "); 120 | LOG.println(RELAY1); 121 | } 122 | 123 | if(BMP180){ 124 | PRESSURE0 = NEXTSLOT; 125 | BMP180TEMP = NEXTSLOT + 2; 126 | NEXTSLOT = BMP180TEMP + 2; 127 | LOG.print("PRESSURE0: "); 128 | LOG.println(PRESSURE0); 129 | LOG.print("BMP180TEMP: "); 130 | LOG.println(BMP180TEMP); 131 | } 132 | } 133 | 134 | 135 | /*******************************************************NUEVA FUNCION 1 PIN CAPACITIVO ***************************************/ 136 | uint8_t readCapacitivePin(int pinToMeasure) { 137 | pinMode(pinToMeasure, OUTPUT); 138 | digitalWrite(pinToMeasure, LOW); 139 | delay(1); 140 | // Prevent the timer IRQ from disturbing our measurement 141 | noInterrupts(); 142 | // Make the pin an input with the internal pull-up on 143 | pinMode(pinToMeasure, INPUT_PULLUP); 144 | 145 | // Now see how long the pin to get pulled up. This manual unrolling of the loop 146 | // decreases the number of hardware cycles between each read of the pin, 147 | // thus increasing sensitivity. 148 | uint8_t cycles = 35;//17; 149 | if (digitalRead(pinToMeasure)) { cycles = 0;} 150 | else if (digitalRead(pinToMeasure)) { cycles = 1;} 151 | else if (digitalRead(pinToMeasure)) { cycles = 2;} 152 | else if (digitalRead(pinToMeasure)) { cycles = 3;} 153 | else if (digitalRead(pinToMeasure)) { cycles = 4;} 154 | else if (digitalRead(pinToMeasure)) { cycles = 5;} 155 | else if (digitalRead(pinToMeasure)) { cycles = 6;} 156 | else if (digitalRead(pinToMeasure)) { cycles = 7;} 157 | else if (digitalRead(pinToMeasure)) { cycles = 8;} 158 | else if (digitalRead(pinToMeasure)) { cycles = 9;} 159 | else if (digitalRead(pinToMeasure)) { cycles = 10;} 160 | else if (digitalRead(pinToMeasure)) { cycles = 11;} 161 | else if (digitalRead(pinToMeasure)) { cycles = 12;} 162 | else if (digitalRead(pinToMeasure)) { cycles = 13;} 163 | else if (digitalRead(pinToMeasure)) { cycles = 14;} 164 | else if (digitalRead(pinToMeasure)) { cycles = 15;} 165 | else if (digitalRead(pinToMeasure)) { cycles = 16;} 166 | else if (digitalRead(pinToMeasure)) { cycles = 17;} 167 | else if (digitalRead(pinToMeasure)) { cycles = 18;} 168 | else if (digitalRead(pinToMeasure)) { cycles = 19;} 169 | else if (digitalRead(pinToMeasure)) { cycles = 20;} 170 | else if (digitalRead(pinToMeasure)) { cycles = 21;} 171 | else if (digitalRead(pinToMeasure)) { cycles = 22;} 172 | else if (digitalRead(pinToMeasure)) { cycles = 23;} 173 | else if (digitalRead(pinToMeasure)) { cycles = 24;} 174 | else if (digitalRead(pinToMeasure)) { cycles = 25;} 175 | else if (digitalRead(pinToMeasure)) { cycles = 26;} 176 | else if (digitalRead(pinToMeasure)) { cycles = 27;} 177 | else if (digitalRead(pinToMeasure)) { cycles = 28;} 178 | else if (digitalRead(pinToMeasure)) { cycles = 29;} 179 | else if (digitalRead(pinToMeasure)) { cycles = 30;} 180 | else if (digitalRead(pinToMeasure)) { cycles = 31;} 181 | else if (digitalRead(pinToMeasure)) { cycles = 32;} 182 | else if (digitalRead(pinToMeasure)) { cycles = 33;} 183 | else if (digitalRead(pinToMeasure)) { cycles = 34;} 184 | 185 | 186 | 187 | // End of timing-critical section 188 | interrupts(); 189 | 190 | // Discharge the pin again by setting it low and output 191 | // It's important to leave the pins low if you want to 192 | // be able to touch more than 1 sensor at a time - if 193 | // the sensor is left pulled high, when you touch 194 | // two sensors, your body will transfer the charge between 195 | // sensors. 196 | digitalWrite(pinToMeasure, LOW); 197 | pinMode(pinToMeasure, OUTPUT); 198 | 199 | return cycles; 200 | } 201 | 202 | 203 | uint8_t CapSense(uint8_t slot, uint8_t value, uint8_t value_hold, uint8_t pin, uint8_t thresold_value, int holdtime) { 204 | 205 | int cycles = readCapacitivePin(pin); 206 | if(DEBUG_CAPSENSE){ 207 | if(millis()%300==0) LOG.println("Pin\tSlotIn\tOut\tPWM\tcycles\tReturn"); 208 | LOG.print(pin); 209 | LOG.print("\t"); 210 | LOG.print(InPin[pin]); 211 | LOG.print("\t"); 212 | LOG.print(mInput(slot)); 213 | LOG.print("\t"); 214 | LOG.print(mOutput(slot)); 215 | LOG.print("\t"); 216 | LOG.print(mOutput(slot+1)); 217 | LOG.print("\t"); 218 | LOG.print(cycles); 219 | LOG.print("\t"); 220 | LOG.print(thresold_value); 221 | LOG.print("\t"); 222 | LOG.print(abs(millis()-time)); 223 | LOG.print("\t"); 224 | 225 | } 226 | 227 | if(cycles > thresold_value && (InPin[pin] == 10 || InPin[pin] == 11)){ 228 | InPin[pin] = PINSET; 229 | } 230 | 231 | if(cycles > thresold_value && (InPin[pin]==PINRESET)) 232 | { 233 | time = millis(); // Record time 234 | InPin[pin] = PINSET; 235 | 236 | return InPin[pin]; 237 | } 238 | else if(cycles > thresold_value && (abs(millis()-time) > holdtime) && (InPin[pin]==PINSET || InPin[pin]==PINACTIVE)) 239 | { 240 | if(AUTOCALIBRATE && (abs(millis()-time) > 15000)){ 241 | config.cap_thresold = cycles + 4; 242 | EEPROM.write(4, cycles + 4); 243 | EEPROM.commit(); 244 | if(DEBUG_CAPSENSE) { 245 | LOG.print("Autocalibrate: "); 246 | LOG.println(config.cap_thresold); 247 | } 248 | return config.cap_thresold; 249 | }else{ 250 | InPin[pin] = PINACTIVE; // Stay there till pushbutton is released 251 | // Write timer value in memory map 252 | if (memory_map) memory_map[MaCaco_IN_s + slot] = value_hold; 253 | return value_hold; 254 | } 255 | } 256 | else if(cycles < thresold_value && (InPin[pin]==PINSET)) { 257 | InPin[pin] = 10; 258 | return InPin[pin]; 259 | } 260 | else if(cycles < thresold_value && (InPin[pin]==PINACTIVE)) { 261 | InPin[pin] = 11; 262 | return InPin[pin]; 263 | } 264 | else if(cycles < thresold_value && InPin[pin] == 10){ 265 | if(mInput(slot) == Souliss_T1n_OffCmd || mInput(slot) == Souliss_T1n_OnCmd){ 266 | if(mOutput(slot+1) == 0) mOutput(slot) = Souliss_T1n_OffCoil; 267 | else mOutput(slot) = Souliss_T1n_OnCoil; 268 | memory_map[MaCaco_IN_s + slot] = Souliss_T1n_RstCmd; // Reset 269 | } 270 | else memory_map[MaCaco_IN_s + slot] = value; 271 | 272 | InPin[pin] = PINRESET; 273 | return value; 274 | } 275 | else if(cycles < thresold_value && InPin[pin] == 11){ 276 | InPin[pin] = PINRESET; 277 | if(mOutput(slot+1) == 0) mOutput(slot) = Souliss_T1n_OffCoil; 278 | else mOutput(slot) = Souliss_T1n_OnCoil; 279 | memory_map[MaCaco_IN_s + slot] = Souliss_T1n_RstCmd; // Reset 280 | } 281 | 282 | // return MaCaco_NODATACHANGED; 283 | 284 | } 285 | 286 | 287 | -------------------------------------------------------------------------------- /SoulissDomo_Device_Example/Souliss_ESPv3_5/PAGE_NetworkConfiguration.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | // 4 | // HTML PAGE 5 | // 6 | const char PAGE_NetworkConfiguration[] PROGMEM = R"=====( 7 | 8 | 9 | <  Network Configuration 10 |
11 | Connect to Router with these settings:
12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
SSID:
Password:
DHCP:
IP: ...
Netmask:...
Gateway:...
22 |
23 |
24 | Connection State:
N/A
25 |
26 | Networks:
27 | 28 | 29 | 30 |
Scanning...
Refresh
31 | 32 | 33 | 62 | 63 | 64 | )====="; 65 | 66 | const char PAGE_WaitAndReload[] PROGMEM = R"=====( 67 | 68 | Please Wait....Configuring and Restarting. 69 | )====="; 70 | 71 | 72 | // 73 | // SEND HTML PAGE OR IF A FORM SUMBITTED VALUES, PROCESS THESE VALUES 74 | // 75 | 76 | void send_network_configuration_html() 77 | { 78 | 79 | if (server.args() > 0 ) // Save Settings 80 | { 81 | String temp = ""; 82 | config.dhcp = false; 83 | for ( uint8_t i = 0; i < server.args(); i++ ) { 84 | if (server.argName(i) == "ssid") config.ssid = urldecode(server.arg(i)); 85 | if (server.argName(i) == "password") config.password = urldecode(server.arg(i)); 86 | if (server.argName(i) == "ip_0") if (checkRange(server.arg(i))) config.IP[0] = server.arg(i).toInt(); 87 | if (server.argName(i) == "ip_1") if (checkRange(server.arg(i))) config.IP[1] = server.arg(i).toInt(); 88 | if (server.argName(i) == "ip_2") if (checkRange(server.arg(i))) config.IP[2] = server.arg(i).toInt(); 89 | if (server.argName(i) == "ip_3") if (checkRange(server.arg(i))) config.IP[3] = server.arg(i).toInt(); 90 | if (server.argName(i) == "nm_0") if (checkRange(server.arg(i))) config.Netmask[0] = server.arg(i).toInt(); 91 | if (server.argName(i) == "nm_1") if (checkRange(server.arg(i))) config.Netmask[1] = server.arg(i).toInt(); 92 | if (server.argName(i) == "nm_2") if (checkRange(server.arg(i))) config.Netmask[2] = server.arg(i).toInt(); 93 | if (server.argName(i) == "nm_3") if (checkRange(server.arg(i))) config.Netmask[3] = server.arg(i).toInt(); 94 | if (server.argName(i) == "gw_0") if (checkRange(server.arg(i))) config.Gateway[0] = server.arg(i).toInt(); 95 | if (server.argName(i) == "gw_1") if (checkRange(server.arg(i))) config.Gateway[1] = server.arg(i).toInt(); 96 | if (server.argName(i) == "gw_2") if (checkRange(server.arg(i))) config.Gateway[2] = server.arg(i).toInt(); 97 | if (server.argName(i) == "gw_3") if (checkRange(server.arg(i))) config.Gateway[3] = server.arg(i).toInt(); 98 | if (server.argName(i) == "dhcp") config.dhcp = true; 99 | } 100 | server.send (200, "text/html", reinterpret_cast(PAGE_WaitAndReload )); 101 | LOG.println("Write Config"); 102 | WriteConfig(); 103 | ConfigureWifi(); 104 | } 105 | else 106 | { 107 | server.send ( 200, "text/html", PAGE_NetworkConfiguration ); 108 | 109 | } 110 | LOG.println(__FUNCTION__); 111 | } 112 | 113 | 114 | 115 | // 116 | // FILL THE PAGE WITH VALUES 117 | // 118 | 119 | void send_network_configuration_values_html() 120 | { 121 | 122 | String values =""; 123 | 124 | values += "ssid|" + (String) config.ssid + "|input\n"; 125 | values += "password|" + (String) config.password + "|input\n"; 126 | values += "ip_0|" + (String) config.IP[0] + "|input\n"; 127 | values += "ip_1|" + (String) config.IP[1] + "|input\n"; 128 | values += "ip_2|" + (String) config.IP[2] + "|input\n"; 129 | values += "ip_3|" + (String) config.IP[3] + "|input\n"; 130 | values += "nm_0|" + (String) config.Netmask[0] + "|input\n"; 131 | values += "nm_1|" + (String) config.Netmask[1] + "|input\n"; 132 | values += "nm_2|" + (String) config.Netmask[2] + "|input\n"; 133 | values += "nm_3|" + (String) config.Netmask[3] + "|input\n"; 134 | values += "gw_0|" + (String) config.Gateway[0] + "|input\n"; 135 | values += "gw_1|" + (String) config.Gateway[1] + "|input\n"; 136 | values += "gw_2|" + (String) config.Gateway[2] + "|input\n"; 137 | values += "gw_3|" + (String) config.Gateway[3] + "|input\n"; 138 | values += "dhcp|" + (String) (config.dhcp ? "checked" : "") + "|chk\n"; 139 | server.send ( 200, "text/plain", values); 140 | LOG.println(__FUNCTION__); 141 | 142 | } 143 | 144 | 145 | // 146 | // FILL THE PAGE WITH NETWORKSTATE & NETWORKS 147 | // 148 | 149 | void send_connection_state_values_html() 150 | { 151 | 152 | String state = "N/A"; 153 | String Networks = ""; 154 | if (WiFi.status() == 0) state = "Idle"; 155 | else if (WiFi.status() == 1) state = "NO SSID AVAILBLE"; 156 | else if (WiFi.status() == 2) state = "SCAN COMPLETED"; 157 | else if (WiFi.status() == 3) state = "CONNECTED"; 158 | else if (WiFi.status() == 4) state = "CONNECT FAILED"; 159 | else if (WiFi.status() == 5) state = "CONNECTION LOST"; 160 | else if (WiFi.status() == 6) state = "DISCONNECTED"; 161 | 162 | 163 | 164 | int n = WiFi.scanNetworks(); 165 | 166 | if (n == 0) 167 | { 168 | Networks = "No networks found!"; 169 | } 170 | else 171 | { 172 | 173 | 174 | Networks = "Found " +String(n) + " Networks
"; 175 | Networks += ""; 176 | Networks += ""; 177 | for (int i = 0; i < n; ++i) 178 | { 179 | int quality=0; 180 | if(WiFi.RSSI(i) <= -100) 181 | { 182 | quality = 0; 183 | } 184 | else if(WiFi.RSSI(i) >= -50) 185 | { 186 | quality = 100; 187 | } 188 | else 189 | { 190 | quality = 2 * (WiFi.RSSI(i) + 100); 191 | } 192 | 193 | 194 | Networks += ""; 195 | } 196 | Networks += "
NameQualityEnc
" + String(WiFi.SSID(i)) + "" + String(quality) + "%" + String((WiFi.encryptionType(i) == ENC_TYPE_NONE)?" ":"*") + "
"; 197 | } 198 | 199 | String values =""; 200 | values += "connectionstate|" + state + "|div\n"; 201 | values += "networks|" + Networks + "|div\n"; 202 | server.send ( 200, "text/plain", values); 203 | LOG.println(__FUNCTION__); 204 | 205 | } 206 | 207 | -------------------------------------------------------------------------------- /SoulissDomo_Device_Example/Souliss_ESPv3_5/Page_Admin.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | // 4 | // HTML PAGE 5 | // 6 | 7 | const char PAGE_AdminMainPage[] PROGMEM = R"=====( 8 | 9 | 10 |

Souliss Node Administration

11 |
12 | General Configuration
13 | Network Configuration
14 | Network Information
15 | NTP Settings
16 | Main Interface
17 | 18 |
19 | Clicking Main Interface Button will leaving Access Point Mode, 20 | Please make a note of your IP Address Node in Network Information 21 |

You can enter this Web Interface again by your NEW IP Address Node given from Network Information.

22 | 23 | 39 | 40 | )====="; 41 | 42 | 43 | -------------------------------------------------------------------------------- /SoulissDomo_Device_Example/Souliss_ESPv3_5/Page_General.h: -------------------------------------------------------------------------------- 1 | // 2 | // HTML PAGE 3 | // 4 | 5 | const char PAGE_AdminGeneralSettings[] PROGMEM = R"=====( 6 | 7 | 8 | <  General Settings 9 |
10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 |

22 |

23 | 24 |
25 | 26 | 27 | 28 | 29 | 41 | 49 | 50 | 59 | 60 | 61 | 62 | 63 |

64 |
65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 |
Node Name
ThingSpeak API
Node Mode
Enabled this Node as Gateway?:
Sensors Configuration: 30 | 40 |
Lights Output Mode: 42 | 48 |
Others: 51 | 58 |
Capacitive Thresold:

Turn on at
Enabled:
Time::
Turn off at:
Enabled:
Time::
94 |
95 |
96 | You will need only ONE Gateway Node, If this is your First Node you must enabled it as Gateway.. 97 | 98 | 117 | )====="; 118 | 119 | 120 | // Functions for this Page 121 | void send_devicename_value_html() 122 | { 123 | 124 | String values =""; 125 | values += "devicename|" + (String) config.DeviceName + "|div\n"; 126 | values += "tsAPI|" + (String) config.tsAPI + "|div\n"; 127 | server.send ( 200, "text/plain", values); 128 | LOG.println(__FUNCTION__); 129 | 130 | } 131 | 132 | void send_general_html() 133 | { 134 | 135 | if (server.args() > 0 ) // Save Settings 136 | { 137 | config.AutoTurnOn = false; 138 | config.AutoTurnOff = false; 139 | config.NodeMode = false; 140 | config.byte0 = 0; 141 | config.byte1 = 0; 142 | config.byte2 = 0; 143 | String temp = ""; 144 | for ( uint8_t i = 0; i < server.args(); i++ ) { 145 | if (server.argName(i) == "devicename") config.DeviceName = urldecode(server.arg(i)); 146 | if (server.argName(i) == "tsAPI") config.tsAPI = urldecode(server.arg(i)); 147 | if (server.argName(i) == "mnenabled") config.NodeMode = true; 148 | if (server.argName(i) == "byte0") config.byte0 = server.arg(i).toInt(); 149 | if (server.argName(i) == "byte1") config.byte1 = server.arg(i).toInt(); 150 | if (server.argName(i) == "byte2") config.byte2 = server.arg(i).toInt(); 151 | if (server.argName(i) == "cap_thresold") config.cap_thresold = server.arg(i).toInt(); 152 | if (server.argName(i) == "tonenabled") config.AutoTurnOn = true; 153 | if (server.argName(i) == "toffenabled") config.AutoTurnOff = true; 154 | if (server.argName(i) == "tonhour") config.TurnOnHour = server.arg(i).toInt(); 155 | if (server.argName(i) == "tonminute") config.TurnOnMinute = server.arg(i).toInt(); 156 | if (server.argName(i) == "toffhour") config.TurnOffHour = server.arg(i).toInt(); 157 | if (server.argName(i) == "toffminute") config.TurnOffMinute = server.arg(i).toInt(); 158 | } 159 | WriteConfig(); 160 | firstStart = true; 161 | ESP.restart(); 162 | } 163 | server.send ( 200, "text/html", PAGE_AdminGeneralSettings ); 164 | LOG.println(__FUNCTION__); 165 | 166 | 167 | } 168 | 169 | void send_general_configuration_values_html() 170 | { 171 | String values =""; 172 | values += "devicename|" + (String) config.DeviceName + "|input\n"; 173 | values += "tsAPI|" + (String) config.tsAPI + "|input\n"; 174 | values += "mnenabled|" + (String) (config.NodeMode ? "checked" : "") + "|chk\n"; 175 | values += "byte0|" + (String) config.byte0 + "|input\n"; 176 | values += "byte1|" + (String) config.byte1 + "|input\n"; 177 | values += "byte2|" + (String) config.byte2 + "|input\n"; 178 | values += "cap_thresold|" + (String) config.cap_thresold + "|input\n"; 179 | values += "tonhour|" + (String) config.TurnOnHour + "|input\n"; 180 | values += "tonminute|" + (String) config.TurnOnMinute + "|input\n"; 181 | values += "toffhour|" + (String) config.TurnOffHour + "|input\n"; 182 | values += "toffminute|" + (String) config.TurnOffMinute + "|input\n"; 183 | values += "toffenabled|" + (String) (config.AutoTurnOff ? "checked" : "") + "|chk\n"; 184 | values += "tonenabled|" + (String) (config.AutoTurnOn ? "checked" : "") + "|chk\n"; 185 | server.send ( 200, "text/plain", values); 186 | LOG.println(__FUNCTION__); 187 | } 188 | 189 | -------------------------------------------------------------------------------- /SoulissDomo_Device_Example/Souliss_ESPv3_5/Page_Information.h: -------------------------------------------------------------------------------- 1 | #ifndef PAGE_INFOMATION_H 2 | #define PAGE_INFOMATION_H 3 | 4 | 5 | // 6 | // The HTML PAGE 7 | // 8 | const char PAGE_Information[] PROGMEM = R"=====( 9 | 10 | 11 | 12 | 13 | <  Network Information 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |
SSID :
IP :
Netmask :
Gateway :
Mac :

NTP Time:
Refresh
28 | 50 | )=====" ; 51 | 52 | 53 | // 54 | // FILL WITH INFOMATION 55 | // 56 | 57 | void send_information_values_html () 58 | { 59 | 60 | String values =""; 61 | 62 | values += "x_ssid|" + (String)WiFi.SSID() + "|div\n"; 63 | values += "x_ip|" + (String) WiFi.localIP()[0] + "." + (String) WiFi.localIP()[1] + "." + (String) WiFi.localIP()[2] + "." + (String) WiFi.localIP()[3] + "|div\n"; 64 | values += "x_gateway|" + (String) WiFi.gatewayIP()[0] + "." + (String) WiFi.gatewayIP()[1] + "." + (String) WiFi.gatewayIP()[2] + "." + (String) WiFi.gatewayIP()[3] + "|div\n"; 65 | values += "x_netmask|" + (String) WiFi.subnetMask()[0] + "." + (String) WiFi.subnetMask()[1] + "." + (String) WiFi.subnetMask()[2] + "." + (String) WiFi.subnetMask()[3] + "|div\n"; 66 | values += "x_mac|" + GetMacAddress() + "|div\n"; 67 | values += "x_ntp|" + (String) DateTime.hour + ":" + (String) + DateTime.minute + ":" + (String) DateTime.second + " " + (String) DateTime.year + "-" + (String) DateTime.month + "-" + (String) DateTime.day + "|div\n"; 68 | server.send ( 200, "text/plain", values); 69 | //check_ESPMode(); 70 | LOG.println(__FUNCTION__); 71 | 72 | } 73 | 74 | 75 | #endif 76 | 77 | -------------------------------------------------------------------------------- /SoulissDomo_Device_Example/Souliss_ESPv3_5/Page_NTPSettings.h: -------------------------------------------------------------------------------- 1 | 2 | const char PAGE_NTPConfiguration[] PROGMEM = R"=====( 3 | 4 | 5 | <  NTP Settings 6 |
7 |
8 | 9 | 10 | 11 | 49 | 50 | 51 |
NTP Server:
Update: minutes (0=disable)
Timezone 12 | 48 |
Daylight saving:
52 |
53 | 71 | )====="; 72 | 73 | 74 | void send_NTP_configuration_html() 75 | { 76 | 77 | 78 | if (server.args() > 0 ) // Save Settings 79 | { 80 | config.daylight = false; 81 | String temp = ""; 82 | for ( uint8_t i = 0; i < server.args(); i++ ) { 83 | if (server.argName(i) == "ntpserver") config.ntpServerName = urldecode( server.arg(i)); 84 | if (server.argName(i) == "update") config.Update_Time_Via_NTP_Every = server.arg(i).toInt(); 85 | if (server.argName(i) == "tz") config.timezone = server.arg(i).toInt(); 86 | if (server.argName(i) == "dst") config.daylight = true; 87 | } 88 | WriteConfig(); 89 | firstStart = true; 90 | } 91 | server.send ( 200, "text/html", PAGE_NTPConfiguration ); 92 | LOG.println(__FUNCTION__); 93 | 94 | } 95 | 96 | 97 | 98 | 99 | 100 | 101 | void send_NTP_configuration_values_html() 102 | { 103 | 104 | String values =""; 105 | values += "ntpserver|" + (String) config.ntpServerName + "|input\n"; 106 | values += "update|" + (String) config.Update_Time_Via_NTP_Every + "|input\n"; 107 | values += "tz|" + (String) config.timezone + "|input\n"; 108 | values += "dst|" + (String) (config.daylight ? "checked" : "") + "|chk\n"; 109 | server.send ( 200, "text/plain", values); 110 | LOG.println(__FUNCTION__); 111 | 112 | } 113 | 114 | -------------------------------------------------------------------------------- /SoulissDomo_Device_Example/Souliss_ESPv3_5/Page_Root.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | const char PAGE_Root[] PROGMEM = R"=====( 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | It work's! 15 | 16 | 17 | 18 | )====="; 19 | 20 | void sendRootPage() 21 | { 22 | if (server.args() > 0 ) // Are there any POST/GET Fields ? 23 | { 24 | for ( uint8_t i = 0; i < server.args(); i++ ) { // Iterate through the fields 25 | 26 | } 27 | } 28 | server.send ( 200, "text/html", reinterpret_cast(PAGE_Root) ); 29 | } 30 | 31 | 32 | -------------------------------------------------------------------------------- /SoulissDomo_Device_Example/Souliss_ESPv3_5/Page_Script.js.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | const char PAGE_microajax_js[] PROGMEM = R"=====( 7 | function microAjax(B,A){this.bindFunction=function(E,D){return function(){return E.apply(D,[D])}};this.stateChange=function(D){if(this.request.readyState==4){this.callbackFunction(this.request.responseText)}};this.getRequest=function(){if(window.ActiveXObject){return new ActiveXObject("Microsoft.XMLHTTP")}else{if(window.XMLHttpRequest){return new XMLHttpRequest()}}return false};this.postBody=(arguments[2]||"");this.callbackFunction=A;this.url=B;this.request=this.getRequest();if(this.request){var C=this.request;C.onreadystatechange=this.bindFunction(this.stateChange,this);if(this.postBody!==""){C.open("POST",B,true);C.setRequestHeader("X-Requested-With","XMLHttpRequest");C.setRequestHeader("Content-type","application/x-www-form-urlencoded");C.setRequestHeader("Connection","close")}else{C.open("GET",B,true)}C.send(this.postBody)}}; 8 | 9 | function setValues(url) 10 | { 11 | microAjax(url, function (res) 12 | { 13 | res.split(String.fromCharCode(10)).forEach(function(entry) { 14 | fields = entry.split("|"); 15 | if(fields[2] == "input") 16 | { 17 | document.getElementById(fields[0]).value = fields[1]; 18 | } 19 | else if(fields[2] == "div") 20 | { 21 | document.getElementById(fields[0]).innerHTML = fields[1]; 22 | } 23 | else if(fields[2] == "chk") 24 | { 25 | document.getElementById(fields[0]).checked = fields[1]; 26 | } 27 | }); 28 | }); 29 | } 30 | 31 | )====="; 32 | 33 | -------------------------------------------------------------------------------- /SoulissDomo_Device_Example/Souliss_ESPv3_5/Page_Style.css.h: -------------------------------------------------------------------------------- 1 | 2 | const char PAGE_Style_css[] PROGMEM = R"=====( 3 | body { color: #000000; font-family: avenir, helvetica, arial, sans-serif; letter-spacing: 0.15em;} 4 | hr { background-color: #eee; border: 0 none; color: #eee; height: 1px; } 5 | .btn, .btn:link, .btn:visited { 6 | border-radius: 0.3em; 7 | border-style: solid; 8 | border-width: 1px; 9 | color: #111; 10 | display: inline-block; 11 | font-family: avenir, helvetica, arial, sans-serif; 12 | letter-spacing: 0.15em; 13 | margin-bottom: 0.5em; 14 | padding: 1em 0.75em; 15 | text-decoration: none; 16 | text-transform: uppercase; 17 | -webkit-transition: color 0.4s, background-color 0.4s, border 0.4s; 18 | transition: color 0.4s, background-color 0.4s, border 0.4s; 19 | } 20 | .btn:hover, .btn:focus { 21 | color: #7FDBFF; 22 | border: 1px solid #7FDBFF; 23 | -webkit-transition: background-color 0.3s, color 0.3s, border 0.3s; 24 | transition: background-color 0.3s, color 0.3s, border 0.3s; 25 | } 26 | .btn:active { 27 | color: #0074D9; 28 | border: 1px solid #0074D9; 29 | -webkit-transition: background-color 0.3s, color 0.3s, border 0.3s; 30 | transition: background-color 0.3s, color 0.3s, border 0.3s; 31 | } 32 | .btn--s 33 | { 34 | font-size: 12px; 35 | } 36 | .btn--m { 37 | font-size: 14px; 38 | } 39 | .btn--l { 40 | font-size: 20px; border-radius: 0.25em !important; 41 | } 42 | .btn--full, .btn--full:link { 43 | border-radius: 0.25em; 44 | display: block; 45 | margin-left: auto; 46 | margin-right: auto; 47 | text-align: center; 48 | width: 100%; 49 | } 50 | .btn--blue:link, .btn--blue:visited { 51 | color: #fff; 52 | background-color: #0074D9; 53 | } 54 | .btn--blue:hover, .btn--blue:focus { 55 | color: #fff !important; 56 | background-color: #0063aa; 57 | border-color: #0063aa; 58 | } 59 | .btn--blue:active { 60 | color: #fff; 61 | background-color: #001F3F; border-color: #001F3F; 62 | } 63 | @media screen and (min-width: 32em) { 64 | .btn--full { 65 | max-width: 16em !important; } 66 | } 67 | )====="; 68 | 69 | 70 | -------------------------------------------------------------------------------- /SoulissDomo_Device_Example/Souliss_ESPv3_5/example.h: -------------------------------------------------------------------------------- 1 | #ifndef PAGE_EXAMPLE_H 2 | #define PAGE_EXAMPLE_H 3 | // 4 | // The EXAMPLE PAGE 5 | // 6 | const char PAGE_example[] PROGMEM = R"=====( 7 | 8 | 9 |

Welcome to SerbaAuto Node

10 |
11 |
Here comes the Dynamic Data in
12 |
-
13 | Click Here to Begin
14 |
-
15 | 16 | 17 |
More info on http://serbaauto.com
18 |
Contact us at serbaauto@gmail.com
19 |
20 | 21 | 39 | 40 | )====="; 41 | #endif 42 | 43 | 44 | void filldynamicdata() 45 | { 46 | String values =""; 47 | values += "mydynamicdata|" + (String) + "SerbaAuto Gateway, Millis since start: " + (String) millis() + "|div\n"; // Build a string, like this: ID|VALUE|TYPE 48 | server.send ( 200, "text/plain", values); 49 | } 50 | 51 | void processExample() 52 | { 53 | if (server.args() > 0 ) // Are there any POST/GET Fields ? 54 | { 55 | LOG.println("atas"); 56 | for ( uint8_t i = 0; i < server.args(); i++ ) { // Iterate through the fields 57 | if (server.argName(i) == "firstname") 58 | { 59 | // Your processing for the transmitted form-variable 60 | String fName = server.arg(i); 61 | LOG.println("tengah"); 62 | } 63 | } 64 | //server.send ( 200, "text/html", PAGE_ESPReboot ); 65 | LOG.println("Admin Time Out"); 66 | AdminTimeOutCounter=0; 67 | LOG.println("Souliss update IP Address"); 68 | GetIPAddress(); 69 | } 70 | 71 | LOG.println("bawah"); 72 | server.send ( 200, "text/html", PAGE_example ); 73 | } 74 | 75 | -------------------------------------------------------------------------------- /SoulissDomo_Device_Example/Souliss_ESPv3_5/global.h: -------------------------------------------------------------------------------- 1 | #ifndef GLOBAL_H 2 | #define GLOBAL_H 3 | 4 | ESP8266WebServer server(80); // The Webserver 5 | boolean firstStart = true; // On firststart = true, NTP will try to get a valid time 6 | int AdminTimeOutCounter = 0; // Counter for Disabling the AdminMode 7 | strDateTime DateTime; // Global DateTime structure, will be refreshed every Second 8 | WiFiUDP UDPNTPClient; // NTP Client 9 | unsigned long UnixTimestamp = 0; // GLOBALTIME ( Will be set by NTP) 10 | boolean Refresh = false; // For Main Loop, to refresh things like GPIO / WS2812 11 | int cNTP_Update = 0; // Counter for Updating the time via NTP 12 | Ticker tkSecond; // Second - Timer for Updating Datetime Structure 13 | boolean AdminEnabled = true; // Enable Admin Mode for a given Time 14 | byte Minute_Old = 100; // Helpvariable for checking, when a new Minute comes up (for Auto Turn On / Off) 15 | boolean nowifi = false; 16 | 17 | 18 | 19 | struct strConfig { 20 | String ssid; 21 | String password; 22 | byte IP[4]; 23 | byte Netmask[4]; 24 | byte Gateway[4]; 25 | boolean dhcp; 26 | String ntpServerName; 27 | long Update_Time_Via_NTP_Every; 28 | long timezone; 29 | boolean daylight; 30 | String DeviceName; 31 | boolean AutoTurnOff; 32 | boolean AutoTurnOn; 33 | byte TurnOffHour; 34 | byte TurnOffMinute; 35 | byte TurnOnHour; 36 | byte TurnOnMinute; 37 | byte LED_R; 38 | byte LED_G; 39 | byte LED_B; 40 | boolean NodeMode; //test node mode as gateway or peer 41 | byte byte0; 42 | byte byte1; 43 | byte byte2; 44 | String tsAPI; 45 | boolean rst; 46 | byte cap_thresold; 47 | 48 | } config; 49 | 50 | 51 | /* 52 | ** 53 | ** CONFIGURATION HANDLING 54 | ** 55 | */ 56 | void Souliss_Node_Start() 57 | { 58 | 59 | // Read Node Mode.. 60 | if (config.NodeMode){ 61 | if(nowifi != 1) { 62 | LOG.println("Gateway Mode"); 63 | // Connect to the WiFi network and get an address from DHCP 64 | SetAsGateway(myvNet_dhcp); // Set this node as gateway for SoulissApp 65 | SetAddressingServer(); 66 | SetAsPeerNode(0x00C7, 1); 67 | SetAsPeerNode(0x00C9, 2); 68 | SetAsPeerNode(0x00CA, 3); 69 | } 70 | else { 71 | LOG.println("No Gateway Mode coz No Wifi"); 72 | } 73 | 74 | } 75 | else { 76 | LOG.println(nowifi); 77 | if(nowifi != 1) { 78 | LOG.println("Peer Mode"); 79 | // This board request an address to the gateway at runtime, no need 80 | // to configure any parameter here. 81 | SetDynamicAddressing(); 82 | GetAddress(); 83 | //SetAddress(0xAB02, 0xFF00, 0xAB01); 84 | //SetAddress(0x00CA, 0xFF00, 0x00C8); 85 | } 86 | else { 87 | LOG.println("No Peer Mode coz No Wifi"); 88 | } 89 | } 90 | 91 | } 92 | 93 | void check_ESPMode() 94 | { 95 | if (WiFi.status() != WL_CONNECTED);{ 96 | Serial.print("Connecting to AP"); 97 | for (int i=0; i < 10; i++){ 98 | (WiFi.status() != WL_CONNECTED); 99 | delay(1000); 100 | Serial.println("."); 101 | //break; 102 | } 103 | } 104 | if (WiFi.status() == WL_CONNECTED) { 105 | Serial.print("Already connect to : "); 106 | Serial.println(WiFi.SSID()); 107 | Serial.println("Admin Time Out"); 108 | AdminTimeOutCounter=0; 109 | WiFi.mode(WIFI_STA); 110 | Serial.println( "STA mode started" ); 111 | Serial.println(WiFi.localIP()); 112 | Serial.println("Souliss update IP Address"); 113 | GetIPAddress(); 114 | delay(500); 115 | nowifi = false; 116 | 117 | } 118 | else 119 | { 120 | Serial.println( "AP mode started coz' No WiFi or No Config" ); 121 | WiFi.mode(WIFI_AP); 122 | WiFi.softAP("Souliss"); 123 | Serial.println(WiFi.softAPIP()); 124 | nowifi = true; 125 | } 126 | 127 | } 128 | 129 | void ConfigureWifi() 130 | { 131 | LOG.println("Configuring Wifi"); 132 | WiFi.begin (config.ssid.c_str(), config.password.c_str()); 133 | check_ESPMode(); 134 | 135 | if (!config.dhcp) 136 | { 137 | WiFi.config(IPAddress(config.IP[0],config.IP[1],config.IP[2],config.IP[3] ), IPAddress(config.Gateway[0],config.Gateway[1],config.Gateway[2],config.Gateway[3] ) , IPAddress(config.Netmask[0],config.Netmask[1],config.Netmask[2],config.Netmask[3] )); 138 | LOG.println("Souliss update IP Address for STATIC"); 139 | GetIPAddress(); 140 | LOG.println(WiFi.localIP()); 141 | } 142 | check_ESPMode(); 143 | } 144 | 145 | bool EEPROM_CONFIG(){ 146 | 147 | //EEPROM CONFIGURATION READ. 148 | 149 | // DHT LDR DALLAS OPTIONS: 150 | //switch (configuration[EEPROM_START]) { 151 | switch (config.byte0) { 152 | case 0: 153 | DHT_SENSOR = false; 154 | LDR_SENSOR = false; 155 | DALLAS_SENSOR = false; 156 | break; 157 | case 1: 158 | DHT_SENSOR = true; 159 | LDR_SENSOR = false; 160 | DALLAS_SENSOR = false; 161 | break; 162 | case 2: 163 | DHT_SENSOR = false; 164 | LDR_SENSOR = true; 165 | DALLAS_SENSOR = false; 166 | break; 167 | case 3: 168 | DHT_SENSOR = false; 169 | LDR_SENSOR = false; 170 | DALLAS_SENSOR = true; 171 | break; 172 | case 4: 173 | DHT_SENSOR = true; 174 | LDR_SENSOR = true; 175 | DALLAS_SENSOR = false; 176 | break; 177 | case 5: 178 | DHT_SENSOR = true; 179 | LDR_SENSOR = false; 180 | DALLAS_SENSOR = true; 181 | break; 182 | case 6: 183 | DHT_SENSOR = false; 184 | LDR_SENSOR = true; 185 | DALLAS_SENSOR = true; 186 | break; 187 | case 7: 188 | DHT_SENSOR = true; 189 | LDR_SENSOR = true; 190 | DALLAS_SENSOR = true; 191 | break; 192 | } 193 | 194 | Serial1.print(DHT_SENSOR); 195 | LOG.print(LDR_SENSOR); 196 | LOG.print(DALLAS_SENSOR); 197 | LOG.print(" DLD (DHT-LDR-DALLAS)"); 198 | LOG.print("\r\n"); 199 | 200 | // PWM PIR RGB OPTIONS: 201 | //switch (configuration[EEPROM_START+1]) { 202 | switch (config.byte1) { 203 | case 0: 204 | PWM_MODE = false; 205 | PIR_MODE = false; 206 | RGB_MODE = false; 207 | break; 208 | case 1: 209 | PWM_MODE = true; 210 | PIR_MODE = false; 211 | RGB_MODE = false; 212 | break; 213 | case 2: 214 | PWM_MODE = false; 215 | PIR_MODE = true; 216 | RGB_MODE = false; 217 | break; 218 | case 3: 219 | PWM_MODE = false; 220 | PIR_MODE = false; 221 | RGB_MODE = true; 222 | break; 223 | } 224 | LOG.print("PPR (PWM-PIR-RGB)"); 225 | LOG.print(PWM_MODE); 226 | LOG.print(PIR_MODE); 227 | LOG.print(RGB_MODE); 228 | LOG.print(" PPR (PWM-PIR-RGB)"); 229 | LOG.print("\r\n"); 230 | 231 | // CAPACITIVE RELAY BMP180 OPTIONS 232 | //switch (configuration[EEPROM_START+2]) { 233 | switch (config.byte2) { 234 | case 0: 235 | CAPACITIVE = false; 236 | RELAY = false; 237 | BMP180 = false; 238 | 239 | break; 240 | case 1: 241 | CAPACITIVE = true; 242 | RELAY = false; 243 | BMP180 = false; 244 | DEBUG_CAPSENSE = false; 245 | break; 246 | case 2: 247 | CAPACITIVE = false; 248 | RELAY = true; 249 | BMP180 = false; 250 | break; 251 | case 3: 252 | CAPACITIVE = false; 253 | RELAY = false; 254 | BMP180 = true; 255 | break; 256 | case 4: 257 | CAPACITIVE = true; 258 | RELAY = false; 259 | BMP180 = false; 260 | DEBUG_CAPSENSE = true; 261 | break; 262 | 263 | } 264 | LOG.print("CRB (CAP-RELAY-BMP180)"); 265 | LOG.print(CAPACITIVE); 266 | LOG.print(RELAY); 267 | LOG.print(BMP180); 268 | LOG.print(" CRB (CAP-RELAY-BMP180)"); 269 | LOG.print("\r\n"); 270 | 271 | return 1; 272 | 273 | } 274 | 275 | void WriteConfig() 276 | { 277 | 278 | LOG.println("Writing Config"); 279 | EEPROM.write(0,'C'); 280 | EEPROM.write(1,'F'); 281 | EEPROM.write(2,'G'); 282 | EEPROM.write(3,config.rst); 283 | EEPROM.write(4,config.cap_thresold); 284 | 285 | EEPROM.write(16,config.dhcp); 286 | EEPROM.write(17,config.daylight); 287 | 288 | EEPROMWritelong(18,config.Update_Time_Via_NTP_Every); // 4 Byte 289 | 290 | EEPROMWritelong(22,config.timezone); // 4 Byte 291 | 292 | 293 | EEPROM.write(26,config.LED_R); 294 | EEPROM.write(27,config.LED_G); 295 | EEPROM.write(28,config.LED_B); 296 | 297 | EEPROM.write(32,config.IP[0]); 298 | EEPROM.write(33,config.IP[1]); 299 | EEPROM.write(34,config.IP[2]); 300 | EEPROM.write(35,config.IP[3]); 301 | 302 | EEPROM.write(36,config.Netmask[0]); 303 | EEPROM.write(37,config.Netmask[1]); 304 | EEPROM.write(38,config.Netmask[2]); 305 | EEPROM.write(39,config.Netmask[3]); 306 | 307 | EEPROM.write(40,config.Gateway[0]); 308 | EEPROM.write(41,config.Gateway[1]); 309 | EEPROM.write(42,config.Gateway[2]); 310 | EEPROM.write(43,config.Gateway[3]); 311 | 312 | EEPROM.write(44,config.AutoTurnOn); 313 | EEPROM.write(45,config.AutoTurnOff); 314 | EEPROM.write(46,config.TurnOnHour); 315 | EEPROM.write(47,config.TurnOnMinute); 316 | EEPROM.write(48,config.TurnOffHour); 317 | EEPROM.write(49,config.TurnOffMinute); 318 | EEPROM.write(50,config.NodeMode); 319 | EEPROM.write(51,config.byte0); 320 | EEPROM.write(52,config.byte1); 321 | EEPROM.write(53,config.byte2); 322 | WriteStringToEEPROM(54,config.DeviceName); //MAX 10 323 | WriteStringToEEPROM(64,config.tsAPI); //MAX 16 324 | 325 | WriteStringToEEPROM(100,config.ssid); 326 | WriteStringToEEPROM(132,config.password); 327 | WriteStringToEEPROM(164,config.ntpServerName); //MAX 20 328 | 329 | EEPROM.commit(); 330 | 331 | } 332 | boolean ReadConfig() 333 | { 334 | 335 | LOG.println("Reading Configuration"); 336 | if (EEPROM.read(0) == 'C' && EEPROM.read(1) == 'F' && EEPROM.read(2) == 'G' ) 337 | { 338 | LOG.println("Configuration Found!"); 339 | config.rst = EEPROM.read(3); 340 | config.cap_thresold = EEPROM.read(4); 341 | 342 | config.dhcp = EEPROM.read(16); 343 | 344 | config.daylight = EEPROM.read(17); 345 | 346 | config.Update_Time_Via_NTP_Every = EEPROMReadlong(18); // 4 Byte 347 | 348 | config.timezone = EEPROMReadlong(22); // 4 Byte 349 | 350 | config.LED_R = EEPROM.read(26); 351 | config.LED_G = EEPROM.read(27); 352 | config.LED_B = EEPROM.read(28); 353 | 354 | config.IP[0] = EEPROM.read(32); 355 | config.IP[1] = EEPROM.read(33); 356 | config.IP[2] = EEPROM.read(34); 357 | config.IP[3] = EEPROM.read(35); 358 | config.Netmask[0] = EEPROM.read(36); 359 | config.Netmask[1] = EEPROM.read(37); 360 | config.Netmask[2] = EEPROM.read(38); 361 | config.Netmask[3] = EEPROM.read(39); 362 | config.Gateway[0] = EEPROM.read(40); 363 | config.Gateway[1] = EEPROM.read(41); 364 | config.Gateway[2] = EEPROM.read(42); 365 | config.Gateway[3] = EEPROM.read(43); 366 | 367 | config.AutoTurnOn = EEPROM.read(44); 368 | config.AutoTurnOff = EEPROM.read(45); 369 | config.TurnOnHour = EEPROM.read(46); 370 | config.TurnOnMinute = EEPROM.read(47); 371 | config.TurnOffHour = EEPROM.read(48); 372 | config.TurnOffMinute = EEPROM.read(49); 373 | config.NodeMode = EEPROM.read(50); 374 | config.byte0 = EEPROM.read(51); 375 | config.byte1 = EEPROM.read(52); 376 | config.byte2 = EEPROM.read(53); 377 | config.DeviceName= ReadStringFromEEPROM(54); //MAX 10 378 | config.tsAPI= ReadStringFromEEPROM(64); //MAX 16 379 | 380 | config.ssid = ReadStringFromEEPROM(100); 381 | config.password = ReadStringFromEEPROM(132); 382 | config.ntpServerName = ReadStringFromEEPROM(164); //MAX 20 383 | 384 | //check_ESPMode(); 385 | 386 | return true; 387 | 388 | } 389 | else 390 | { 391 | LOG.println("Configuration NOT FOUND!!!!"); 392 | return false; 393 | } 394 | } 395 | 396 | /* 397 | ** 398 | ** NTP 399 | ** 400 | */ 401 | 402 | const int NTP_PACKET_SIZE = 48; 403 | byte packetBuffer[ NTP_PACKET_SIZE]; 404 | void NTPRefresh() 405 | { 406 | 407 | 408 | 409 | 410 | if (WiFi.status() == WL_CONNECTED) 411 | { 412 | IPAddress timeServerIP; 413 | WiFi.hostByName(config.ntpServerName.c_str(), timeServerIP); 414 | //sendNTPpacket(timeServerIP); // send an NTP packet to a time server 415 | LOG.print("Reconnections: "); 416 | LOG.print(DEBUG_RECONNECTS); 417 | LOG.printf(" FreeMem:%d %d:%d:%d %d.%d.%d \n",ESP.getFreeHeap() , DateTime.hour,DateTime.minute, DateTime.second, DateTime.year, DateTime.month, DateTime.day); 418 | LOG.println("sending NTP packet..."); 419 | memset(packetBuffer, 0, NTP_PACKET_SIZE); 420 | packetBuffer[0] = 0b11100011; // LI, Version, Mode 421 | packetBuffer[1] = 0; // Stratum, or type of clock 422 | packetBuffer[2] = 6; // Polling Interval 423 | packetBuffer[3] = 0xEC; // Peer Clock Precision 424 | packetBuffer[12] = 49; 425 | packetBuffer[13] = 0x4E; 426 | packetBuffer[14] = 49; 427 | packetBuffer[15] = 52; 428 | UDPNTPClient.beginPacket(timeServerIP, 123); 429 | UDPNTPClient.write(packetBuffer, NTP_PACKET_SIZE); 430 | UDPNTPClient.endPacket(); 431 | 432 | 433 | delay(1000); 434 | 435 | int cb = UDPNTPClient.parsePacket(); 436 | if (!cb) { 437 | LOG.println("NTP no packet yet"); 438 | } 439 | else 440 | { 441 | LOG.print("NTP packet received, length="); 442 | LOG.println(cb); 443 | UDPNTPClient.read(packetBuffer, NTP_PACKET_SIZE); // read the packet into the buffer 444 | unsigned long highWord = word(packetBuffer[40], packetBuffer[41]); 445 | unsigned long lowWord = word(packetBuffer[42], packetBuffer[43]); 446 | unsigned long secsSince1900 = highWord << 16 | lowWord; 447 | const unsigned long seventyYears = 2208988800UL; 448 | unsigned long epoch = secsSince1900 - seventyYears; 449 | UnixTimestamp = epoch; 450 | } 451 | } 452 | } 453 | 454 | void Second_Tick() 455 | { 456 | strDateTime tempDateTime; 457 | AdminTimeOutCounter++; 458 | cNTP_Update++; 459 | UnixTimestamp++; 460 | ConvertUnixTimeStamp(UnixTimestamp + (config.timezone * 360) , &tempDateTime); 461 | if (config.daylight) // Sommerzeit beachten 462 | if (summertime(tempDateTime.year,tempDateTime.month,tempDateTime.day,tempDateTime.hour,0)) 463 | { 464 | ConvertUnixTimeStamp(UnixTimestamp + (config.timezone * 360) + 3600, &DateTime); 465 | } 466 | else 467 | { 468 | DateTime = tempDateTime; 469 | } 470 | else 471 | { 472 | DateTime = tempDateTime; 473 | } 474 | Refresh = true; 475 | } 476 | 477 | 478 | #endif 479 | 480 | -------------------------------------------------------------------------------- /SoulissDomo_Device_Example/Souliss_ESPv3_5/helpers.h: -------------------------------------------------------------------------------- 1 | #ifndef HELPERS_H 2 | #define HELPERS_H 3 | 4 | 5 | 6 | static const uint8_t monthDays[]={31,28,31,30,31,30,31,31,30,31,30,31}; 7 | #define LEAP_YEAR(Y) ( ((1970+Y)>0) && !((1970+Y)%4) && ( ((1970+Y)%100) || !((1970+Y)%400) ) ) 8 | 9 | 10 | struct strDateTime 11 | { 12 | byte hour; 13 | byte minute; 14 | byte second; 15 | int year; 16 | byte month; 17 | byte day; 18 | byte wday; 19 | 20 | } ; 21 | 22 | 23 | 24 | // 25 | // Summertime calculates the daylight saving for a given date. 26 | // 27 | boolean summertime(int year, byte month, byte day, byte hour, byte tzHours) 28 | // input parameters: "normal time" for year, month, day, hour and tzHours (0=UTC, 1=MEZ) 29 | { 30 | if (month<3 || month>10) return false; // keine Sommerzeit in Jan, Feb, Nov, Dez 31 | if (month>3 && month<10) return true; // Sommerzeit in Apr, Mai, Jun, Jul, Aug, Sep 32 | if (month==3 && (hour + 24 * day)>=(1 + tzHours + 24*(31 - (5 * year /4 + 4) % 7)) || month==10 && (hour + 24 * day)<(1 + tzHours + 24*(31 - (5 * year /4 + 1) % 7))) 33 | return true; 34 | else 35 | return false; 36 | } 37 | 38 | // 39 | // Check the Values is between 0-255 40 | // 41 | boolean checkRange(String Value) 42 | { 43 | if (Value.toInt() < 0 || Value.toInt() > 255) 44 | { 45 | return false; 46 | } 47 | else 48 | { 49 | return true; 50 | } 51 | } 52 | 53 | 54 | void WriteStringToEEPROM(int beginaddress, String string) 55 | { 56 | char charBuf[string.length()+1]; 57 | string.toCharArray(charBuf, string.length()+1); 58 | for (int t= 0; t 31) break; 73 | counter++; 74 | retString.concat(rChar); 75 | 76 | } 77 | return retString; 78 | } 79 | void EEPROMWritelong(int address, long value) 80 | { 81 | byte four = (value & 0xFF); 82 | byte three = ((value >> 8) & 0xFF); 83 | byte two = ((value >> 16) & 0xFF); 84 | byte one = ((value >> 24) & 0xFF); 85 | 86 | //Write the 4 bytes into the eeprom memory. 87 | EEPROM.write(address, four); 88 | EEPROM.write(address + 1, three); 89 | EEPROM.write(address + 2, two); 90 | EEPROM.write(address + 3, one); 91 | } 92 | long EEPROMReadlong(long address) 93 | { 94 | //Read the 4 bytes from the eeprom memory. 95 | long four = EEPROM.read(address); 96 | long three = EEPROM.read(address + 1); 97 | long two = EEPROM.read(address + 2); 98 | long one = EEPROM.read(address + 3); 99 | 100 | //Return the recomposed long by using bitshift. 101 | return ((four << 0) & 0xFF) + ((three << 8) & 0xFFFF) + ((two << 16) & 0xFFFFFF) + ((one << 24) & 0xFFFFFFFF); 102 | } 103 | 104 | void ConvertUnixTimeStamp( unsigned long TimeStamp, struct strDateTime* DateTime) 105 | { 106 | uint8_t year; 107 | uint8_t month, monthLength; 108 | uint32_t time; 109 | unsigned long days; 110 | time = (uint32_t)TimeStamp; 111 | DateTime->second = time % 60; 112 | time /= 60; // now it is minutes 113 | DateTime->minute = time % 60; 114 | time /= 60; // now it is hours 115 | DateTime->hour = time % 24; 116 | time /= 24; // now it is days 117 | DateTime->wday = ((time + 4) % 7) + 1; // Sunday is day 1 118 | 119 | year = 0; 120 | days = 0; 121 | while((unsigned)(days += (LEAP_YEAR(year) ? 366 : 365)) <= time) { 122 | year++; 123 | } 124 | DateTime->year = year; // year is offset from 1970 125 | 126 | days -= LEAP_YEAR(year) ? 366 : 365; 127 | time -= days; // now it is days in this year, starting at 0 128 | 129 | days=0; 130 | month=0; 131 | monthLength=0; 132 | for (month=0; month<12; month++) { 133 | if (month==1) { // february 134 | if (LEAP_YEAR(year)) { 135 | monthLength=29; 136 | } else { 137 | monthLength=28; 138 | } 139 | } else { 140 | monthLength = monthDays[month]; 141 | } 142 | 143 | if (time >= monthLength) { 144 | time -= monthLength; 145 | } else { 146 | break; 147 | } 148 | } 149 | DateTime->month = month + 1; // jan is month 1 150 | DateTime->day = time + 1; // day of month 151 | DateTime->year += 1970; 152 | 153 | 154 | } 155 | 156 | 157 | 158 | String GetMacAddress() 159 | { 160 | uint8_t mac[6]; 161 | char macStr[18] = {0}; 162 | WiFi.macAddress(mac); 163 | sprintf(macStr, "%02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); 164 | return String(macStr); 165 | } 166 | 167 | // convert a single hex digit character to its integer value (from https://code.google.com/p/avr-netino/) 168 | unsigned char h2int(char c) 169 | { 170 | if (c >= '0' && c <='9'){ 171 | return((unsigned char)c - '0'); 172 | } 173 | if (c >= 'a' && c <='f'){ 174 | return((unsigned char)c - 'a' + 10); 175 | } 176 | if (c >= 'A' && c <='F'){ 177 | return((unsigned char)c - 'A' + 10); 178 | } 179 | return(0); 180 | } 181 | 182 | String urldecode(String input) // (based on https://code.google.com/p/avr-netino/) 183 | { 184 | char c; 185 | String ret = ""; 186 | 187 | for(byte t=0;t 8 | 9 |

Welcome to Souliss

10 |
11 | 12 |
Souliss Node
13 |
14 | Click Here to Begin
15 |
16 | 17 | 18 |
Click the check button to Reboot:
19 |
20 |
21 |
22 |

Contact us at juanpintom@gmail.com

23 |

Install SoulissApp in Google Play Store to control this node

24 | 25 |
26 |

Present to You by Juan Pinto - Thanks to Dario, Lesjaw, Dom and others..

27 | 28 | 29 | 30 | 49 | 50 | )====="; 51 | #endif 52 | 53 | 54 | void filldynamicdata() 55 | { 56 | //Serial.println("Dynamic Data Run"); 57 | String values =""; 58 | values += "mydynamicdata|" + (String) + "Souliss Node, Millis since start: " + (String) millis() + "|div\n"; // Build a string, like this: ID|VALUE|TYPE 59 | server.send ( 200, "text/plain", values); 60 | 61 | } 62 | 63 | void processMain() 64 | { 65 | 66 | if (server.args() > 0 ) // Reboot Settings 67 | { 68 | config.rst = true; 69 | String temp = ""; 70 | for ( uint8_t i = 0; i < server.args(); i++ ) { 71 | if (server.argName(i) == "rst") config.rst = false; 72 | LOG.println(F("EEPROM Clear, Size: ")); 73 | LOG.println(STORE__SIZE); 74 | //Store_Clear(); 75 | for(int i=0;i(PAGE_main)); 86 | Serial.println(__FUNCTION__); 87 | 88 | } 89 | 90 | void send_reset_values_html() 91 | { 92 | String values =""; 93 | values += "rst|" + (String) (config.rst ? "checked" : "") + "|chk\n"; 94 | server.send ( 200, "text/plain", values); 95 | Serial.println(__FUNCTION__); 96 | } 97 | -------------------------------------------------------------------------------- /Souliss_Tutorial_Español.md: -------------------------------------------------------------------------------- 1 | ##Souliss - Tutoriales en Español 2 | 3 | #Indice 4 | -------------------------------------------------------------------------------- /TODO.md: -------------------------------------------------------------------------------- 1 | -Upload images to Github 2 | -Upload libraries 3 | -------------------------------------------------------------------------------- /images/Imagenes Tutorial Appsi/Screenshot_2015-11-22-19-34-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpintom/Souliss_ESP_Examples/f1eb10cb5757ab4166bf92796a4896bfa5f36238/images/Imagenes Tutorial Appsi/Screenshot_2015-11-22-19-34-32.png -------------------------------------------------------------------------------- /images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-17-21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpintom/Souliss_ESP_Examples/f1eb10cb5757ab4166bf92796a4896bfa5f36238/images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-17-21.png -------------------------------------------------------------------------------- /images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-18-26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpintom/Souliss_ESP_Examples/f1eb10cb5757ab4166bf92796a4896bfa5f36238/images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-18-26.png -------------------------------------------------------------------------------- /images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-18-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpintom/Souliss_ESP_Examples/f1eb10cb5757ab4166bf92796a4896bfa5f36238/images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-18-50.png -------------------------------------------------------------------------------- /images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-19-03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpintom/Souliss_ESP_Examples/f1eb10cb5757ab4166bf92796a4896bfa5f36238/images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-19-03.png -------------------------------------------------------------------------------- /images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-19-19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpintom/Souliss_ESP_Examples/f1eb10cb5757ab4166bf92796a4896bfa5f36238/images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-19-19.png -------------------------------------------------------------------------------- /images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-19-25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpintom/Souliss_ESP_Examples/f1eb10cb5757ab4166bf92796a4896bfa5f36238/images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-19-25.png -------------------------------------------------------------------------------- /images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-19-39.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpintom/Souliss_ESP_Examples/f1eb10cb5757ab4166bf92796a4896bfa5f36238/images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-19-39.png -------------------------------------------------------------------------------- /images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-19-46.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpintom/Souliss_ESP_Examples/f1eb10cb5757ab4166bf92796a4896bfa5f36238/images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-19-46.png -------------------------------------------------------------------------------- /images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-20-28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpintom/Souliss_ESP_Examples/f1eb10cb5757ab4166bf92796a4896bfa5f36238/images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-20-28.png -------------------------------------------------------------------------------- /images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-20-34.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpintom/Souliss_ESP_Examples/f1eb10cb5757ab4166bf92796a4896bfa5f36238/images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-20-34.png -------------------------------------------------------------------------------- /images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-20-45.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpintom/Souliss_ESP_Examples/f1eb10cb5757ab4166bf92796a4896bfa5f36238/images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-20-45.png -------------------------------------------------------------------------------- /images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-34-27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpintom/Souliss_ESP_Examples/f1eb10cb5757ab4166bf92796a4896bfa5f36238/images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-34-27.png -------------------------------------------------------------------------------- /images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-36-25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpintom/Souliss_ESP_Examples/f1eb10cb5757ab4166bf92796a4896bfa5f36238/images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-36-25.png -------------------------------------------------------------------------------- /images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-36-31.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpintom/Souliss_ESP_Examples/f1eb10cb5757ab4166bf92796a4896bfa5f36238/images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-36-31.png -------------------------------------------------------------------------------- /images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-36-45.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpintom/Souliss_ESP_Examples/f1eb10cb5757ab4166bf92796a4896bfa5f36238/images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-36-45.png -------------------------------------------------------------------------------- /images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-37-03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpintom/Souliss_ESP_Examples/f1eb10cb5757ab4166bf92796a4896bfa5f36238/images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-37-03.png -------------------------------------------------------------------------------- /images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-37-09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpintom/Souliss_ESP_Examples/f1eb10cb5757ab4166bf92796a4896bfa5f36238/images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-37-09.png -------------------------------------------------------------------------------- /images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-38-07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpintom/Souliss_ESP_Examples/f1eb10cb5757ab4166bf92796a4896bfa5f36238/images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-38-07.png -------------------------------------------------------------------------------- /images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-39-08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpintom/Souliss_ESP_Examples/f1eb10cb5757ab4166bf92796a4896bfa5f36238/images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-39-08.png -------------------------------------------------------------------------------- /images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-39-47.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpintom/Souliss_ESP_Examples/f1eb10cb5757ab4166bf92796a4896bfa5f36238/images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-39-47.png -------------------------------------------------------------------------------- /images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-40-27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpintom/Souliss_ESP_Examples/f1eb10cb5757ab4166bf92796a4896bfa5f36238/images/Imagenes Tutorial Appsi/Screenshot_2015-11-23-16-40-27.png -------------------------------------------------------------------------------- /images/detail: -------------------------------------------------------------------------------- 1 | Images folder. 2 | --------------------------------------------------------------------------------