arduino-nodemcu連接wifi

#include <ESP8266WiFi.h>

String ssid="test";
String pass="12345678";
void setup() {
  // put your setup code here, to run once:

  WiFi.mode(WIFI_STA);
  WiFi.begin("test", "12345678");
  Serial.begin(115200);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());
}

void loop() {
  // put your main code here, to run repeatedly:

}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章