为ESP8266写一段联网程序
时间: 2023-02-19 15:13:34 浏览: 77
#include <ESP8266WiFi.h>
void setup() {
Serial.begin(115200);
// Connect to a WiFi network
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");
// Print the IP address
Serial.println(WiFi.localIP());
}
void loop() {
// put your main code here, to run repeatedly:
}
阅读全文