執行結果:
程式碼:
/* Name: ConnectWiFi.ino Created: 2017/3/14 上午 11:01:28 Author: C.Y.Fang */ #include "ESP8266WiFi.h" //SSID const char *ssid = "ssid"; //Password const char *password = "password"; void setup() { Serial.begin(115200); delay(100); Serial.println(); Serial.println(); Serial.print("Connecting to "); Serial.println(ssid); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.println("WiFi connected"); Serial.println(""); Serial.println(WiFi.localIP()); Serial.println(WiFi.gatewayIP()); Serial.println(WiFi.subnetMask()); } void loop() { }