Last active
September 3, 2015 19:38
-
-
Save chaeplin/190ba7175d1e8098a629 to your computer and use it in GitHub Desktop.
esp8266_wifi_test
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
#include <ESP8266WiFi.h> | |
//#include <IPAddress.h> | |
const char* ssid = "wifi_ssid"; | |
const char* password = "wifi_password"; | |
WiFiClient wifiClient; | |
long startMills; | |
void setup() { | |
delay(50); | |
startMills = millis(); | |
Serial.begin(38400); | |
Serial.println(millis() - startMills); | |
Serial.println(); | |
Serial.println(); | |
Serial.print("Connecting to "); | |
Serial.println(ssid); | |
WiFi.mode(WIFI_STA); | |
Serial.println(millis() - startMills); | |
WiFi.begin(ssid, password); | |
WiFi.config(IPAddress(192, 168, 10, 15), IPAddress(192, 168, 10, 1), IPAddress(255, 255, 255, 0)); | |
Serial.println(millis() - startMills); | |
while (WiFi.status() != WL_CONNECTED) { | |
Serial.print("."); | |
delay(100); | |
} | |
Serial.println(""); | |
Serial.println(millis() - startMills); | |
Serial.println("WiFi connected"); | |
Serial.println("IP address: "); | |
Serial.println(WiFi.localIP()); | |
Serial.println("done"); | |
} | |
void loop() { | |
delay(200); | |
Serial.println("going to sleep"); | |
ESP.deepSleep(5000000, WAKE_RF_DEFAULT); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
include <ESP8266WiFi.h>
extern "C"{
include "user_interface.h"
}