@mdma I am on system firmware 0.4.7.
I’ve stripped down my sketch to the bare essentials. Could you please try running this after replacing the WIFI credentials & desired Static IP near the top of the networkConnect() function? Connect to console when you see the blue D7 LED light up and it should report everything there. Does it use your Static IP?
SYSTEM_MODE(SEMI_AUTOMATIC);
#define STATUS_LED D7
//Global variables
boolean useStaticIP = true;
void setup(void) {
// debug LED setup
pinMode(STATUS_LED, OUTPUT);
digitalWrite(STATUS_LED, HIGH);
Time.zone(-8);
delay(5000);
Serial.begin(57600);
delay(2000);
Serial.println("Hello there!");
// read wifi .INI and connect to network
networkConnect();
}
void loop() {
}
void networkConnect()
{
char networkSSID[33] = "mySSID";
char networkPass[65] = "myPass";
// WLAN_SEC_UNSEC = 0
// WLAN_SEC_WEP = 1
// WLAN_SEC_WPA = 2
// WLAN_SEC_WPA2 = 3
int authValue = 3;
// WLAN_CIPHER_NOT_SET = 0
// WLAN_CIPHER_AES = 1
// WLAN_CIPHER_TKIP = 2
// WLAN_CIPHER_AES_TKIP = 3
int cipherValue = 1;
uint8_t serverIP[] = {192, 168, 1, 150};
IPAddress myAddress = serverIP;
uint8_t serverNM[] = {255, 255, 255, 0};
IPAddress netmask = serverNM;
uint8_t serverGW[] = {192, 168, 1, 1};
IPAddress gateway = serverGW;
uint8_t serverDNS[] = {192, 168, 1, 1};
IPAddress dns = serverDNS;
// Static IP or DHCP?
if (useStaticIP)
{
Serial.print("Using Static IP Address: ");
Serial.print(serverIP[0]);
Serial.print(".");
Serial.print(serverIP[1]);
Serial.print(".");
Serial.print(serverIP[2]);
Serial.print(".");
Serial.println(serverIP[3]);
WiFi.setStaticIP(myAddress, netmask, gateway, dns);
WiFi.useStaticIP();
}
else Serial.println("Using DHCP");
if (Spark.connected() == false) {
Serial.println("WiFi On...");
WiFi.on();
Serial.println("Clearing Credentials...");
WiFi.clearCredentials();
Serial.println("Setting Credentials...");
// set Credentials
if (authValue > -1 && cipherValue > -1)
{
WiFi.setCredentials(networkSSID, networkPass, authValue, cipherValue);
}
else if (authValue > -1)
{
WiFi.setCredentials(networkSSID, networkPass, authValue);
}
else WiFi.setCredentials(networkSSID, networkPass);
WiFi.connect(WIFI_CONNECT_SKIP_LISTEN);
if (WiFi.hasCredentials())
{
Serial.println("We have Credentials! Connecting to Cloud...");
Spark.connect();
while(!Spark.connected())
{
Particle.process();
}
Serial.println("Connected to:");
Serial.println(WiFi.localIP());
Serial.println(WiFi.subnetMask());
Serial.println(WiFi.gatewayIP());
Serial.println(WiFi.SSID());
}
else Serial.println("We have NO Credentials.");
}
Serial.println("---");
Serial.print("deviceID: ");
String myID = System.deviceID();
Serial.println(myID);
Serial.printlnf("System version: %s", System.version().c_str());
uint32_t freemem = System.freeMemory();
Serial.print("free memory: ");
Serial.println(freemem);
}