惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Securelist
O
OpenAI News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Threat Research - Cisco Blogs
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Google Online Security Blog
Google Online Security Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
N
News and Events Feed by Topic
S
Security Affairs
SecWiki News
SecWiki News
Project Zero
Project Zero
L
Lohrmann on Cybersecurity
P
Proofpoint News Feed
P
Palo Alto Networks Blog
L
LINUX DO - 最新话题
H
Hacker News: Front Page
Recent Commits to openclaw:main
Recent Commits to openclaw:main
I
Intezer
Simon Willison's Weblog
Simon Willison's Weblog
W
WeLiveSecurity
T
The Exploit Database - CXSecurity.com
K
Kaspersky official blog
The GitHub Blog
The GitHub Blog
I
InfoQ
云风的 BLOG
云风的 BLOG
雷峰网
雷峰网
B
Blog
IT之家
IT之家
AWS News Blog
AWS News Blog
Jina AI
Jina AI
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Google DeepMind News
Google DeepMind News
Spread Privacy
Spread Privacy
N
News and Events Feed by Topic
Security Latest
Security Latest
美团技术团队
C
Check Point Blog
WordPress大学
WordPress大学
T
Tenable Blog
S
Security @ Cisco Blogs
Last Week in AI
Last Week in AI
博客园 - 聂微东
月光博客
月光博客
博客园 - 【当耐特】
S
Schneier on Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
Secure Thoughts
Schneier on Security
Schneier on Security
C
Cisco Blogs
Cyberwarzone
Cyberwarzone

Lan小站-嗯,不错! - 物联网

ESP8266开发板接入点模式 - Lan小站-嗯,不错! MicroPython控制ESP8266灯光开关 - Lan小站-嗯,不错!
ESP8266开发板无线终端模式 - Lan小站-嗯,不错!
Lan · 2021-02-25 · via Lan小站-嗯,不错! - 物联网
#include <ESP8266WiFi.h>  // 程序使用ESP8266WiFi库
const char *ssid = "WIFI名";  //WIFI名
const char *pwd = "密码"; //WIFI密码

void setup() {
  Serial.begin(9600);  //启动串口通讯
  WiFi.begin(ssid,pwd); //连接
  while (WiFi.status() != WL_CONNECTED){
    delay(1000); //每隔一秒重连一次
    Serial.print('.');
  }
  Serial.print("IP:");
  Serial.print(WiFi.localIP()); //输出IP
}

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

}

连接WIFI并输出IP地址

升级版,多个WIFI备选

#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>

ESP8266WiFiMulti wifiMulti; //实例化对象

void setup()
{
  Serial.begin(9600);
  wifiMulti.addAP("WI-FI","12345678");
  wifiMulti.addAP("WI-FI_5G","12345678");
  
  while (wifiMulti.run() != WL_CONNECTED)
  {
    delay(1000);
    Serial.print('.');
  }
  Serial.print("Connected to ");
  Serial.println(WiFi.SSID());
  Serial.print("IP:");
  Serial.print(WiFi.localIP());
}

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

学习教程-太极创客:http://www.taichi-maker.com/homepage/esp8266-nodemcu-iot/iot-c/