#define WIFICONF_INSKETCH
#define WiFi_SSID "SSID"
#define WiFi_Password "pass"
// Include framework code and libraries
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <EEPROM.h>
#include <SPI.h>
#include <WiFiUdp.h>
// Configure the framework
#include "bconf/MCU_ESP8266.h" // Load the code directly on the ESP8266
#include "conf/RuntimeGateway.h" // This node is a Peer and can became a Gateway at runtime
#include "conf/DynamicAddressing.h" // Use dynamically assigned addresses
#include "conf/IPBroadcast.h" // Use IP Broadcast for Ethernet/WiFi nodes without a static address
#include "conf/WEBCONFinterface.h" // Web Config
void setup(){ Serial.begin(115200);
Initialize();
pinMode(0, INPUT);
WiFi.printDiag(Serial);
if(subscribe(Notify_GatewayAlive)) { Serial.println("Setting as Peer"); // This board request an address to the gateway at runtime, no need // to configure any parameter here. SetDynamicAddressing(); GetAddress(); } else { Serial.println("Setting as Gateway"); // Connect to the WiFi network and get an address from DHCP Souliss_GetIPAddress(); SetAsGateway(myvNet_dhcp); // Set this node as gateway for SoulissApp SetAddressingServer(); }
Serial.println("Received IP address: "); Serial.println(WiFi.localIP());
}
void loop(){ if(!digitalRead(0)) { Serial.println("Initializing configuration space"); // Initialize config store Store_Init(); Store_Clear(); Store_Commit(); Serial.println("Start WebConfig"); // Start the node as access point with a configuration WebServer SetAccessPoint(); startWebServer(); // We have nothing more than the WebServer for the configuration // to run, once configured the node will quit this. while(1) { yield(); runWebServer(); } }
// Here we start to play EXECUTEFAST() { UPDATEFAST();
FAST_50ms() { // We process the logic and relevant input and output every 50 millisecond ProcessCommunication(); }
if (IsRuntimeGateway()){ FAST_21110ms() { publish(Notify_GatewayAlive); } FAST_GatewayComms();
} else { FAST_PeerComms(); } } EXECUTESLOW() { UPDATESLOW(); if (!IsRuntimeGateway()) SLOW_PeerJoin(); }}
You should define if the node shall start as access point with WebConfig at the setup() before all the configuration steps.
Look at the LYT8266 example. Use the latest Souliss release.
Dario.
From Mobile.
--
You received this message because you are subscribed to the Google Groups "souliss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to souliss+unsubscribe@googlegroups.com.
To post to this group, send email to sou...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/souliss/2017efc0-4075-4012-858d-9ab6c978e0b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.