The router isn't connected to the internet - the network is just for sketch uploading and control messages via udp.
I'm having issues though and not sure how to debug either.
I have assigned static ip addresses to the boards, mainly to rule out conflicts but also so I know which is which.
Basically sometimes one or all of the boards loses connection to the wifi and if I cycle the power to it it won't reconnect to the network. The only way to sort it out is to cycle the power to the router.
I'm imagining (guessing) this is something to do with DHCP. The lease time is set to 'forever' on the router. The smallest time period is half an hour.
My code is largely taken from the Basic OTA arduino sketch. (see below)
I know I haven't given you alot to go on but I'm not really sure what is happening. Has anyone got any ideas for a method to get to the bottom of this? Or anything I'm missing?
Edit***I know that the static ip should override dhcp but I was wondering if perhaps the router was either saving the ip address after initial connection, perhaps because it didn't know the connection had been lost. Guesswork again!
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
WiFiUDP port;
char packetBuffer[255];
unsigned int localPort = 9999;
// config static IP
IPAddress ip(192, 168, 42, 23); // where xx is the desired IP Address
IPAddress gateway(192, 168, 42, 254); // set gateway to match your network
IPAddress subnet(255, 255, 255, 0); // set subnet mask to match your network
const char* ssid = "lalalala";
const char* password = "notrealobvs";
//this bit is in setup
WiFi.mode(WIFI_STA);
WiFi.config(ip, gateway, subnet);
WiFi.begin(ssid, password);
while (WiFi.waitForConnectResult() != WL_CONNECTED) {
Serial.println("Connection Failed! No Network...");
delay(5000);
//ESP.restart(); I commented this out cos I want the code to run if the network doesn't exist
break;