close
#include <WiFi.h>
//匯入Wifi.h標頭檔
const char* ssid="你的AP名稱SSID";
const char* passphrase="你的WIFI密碼";
void setup() {
// put your setup code here, to run once:
//設定包率
Serial.begin(115200);
//Wifi開始啟動(AP名稱,密碼),連上網路
WiFi.begin(ssid,passphrase);
//當 (WIFI狀態 不等於 連線狀態) TRUE
//會一直執行迴圈程式,直到Wifi狀態為連線狀態,才會繼續執行下面程式
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println(WiFi.localIP());
delay(5000);
}
全站熱搜