Skip to content

Instantly share code, notes, and snippets.

@pfeerick
Last active December 18, 2016 00:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pfeerick/8576753d423f15c34fb7a5098a291e8f to your computer and use it in GitHub Desktop.
Save pfeerick/8576753d423f15c34fb7a5098a291e8f to your computer and use it in GitHub Desktop.
Demo sketch showing how to configure a Digistump Oak's wifi manually with a static IP without a Particle connection
SYSTEM_MODE(MANUAL);
#include <ESP8266WiFi.h>
//Static IP stuff
char SSID[] = "yournetwork"; // your network SSID
char passwd[] = "yourpassword"; // your network password
//WiFi config stuff
IPAddress ip(192, 168, 0, 70); //your static IP
IPAddress gateway(192, 168, 0, 1); //your gateway IP
IPAddress subnet(255, 255, 255, 0); //your subnet mask
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
//don't save these details
WiFi.persistent(false);
//configure the WiFi to use the custom settings
WiFi.config(ip, gateway, subnet);
//start the WiFi connection process
WiFi.begin_internal(SSID, passwd, 0, NULL);
//wait for WiFi to connect
while (WiFi.status() != WL_CONNECTED)
{
digitalWrite(LED_BUILTIN, HIGH);
delay(100);
digitalWrite(LED_BUILTIN, LOW);
delay(100);
}
}
void loop()
{
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment