Last active
December 18, 2016 00:32
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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