首页 > 其他 > 详细

Arduino与NodeMCU——联网

时间:2019-06-28 15:29:18      阅读:159      评论:0      收藏:0      [点我收藏+]

我们现在要使用Arduino IDE来配置您的ESP8266芯片。这是使用该芯片的好方法,因为您可以使用着名的Arduino IDE对其进行编程,并重复使用几个现有的Arduino库。
如果尚未完成,请安装最新版本的Arduino IDE。您可以从http://www.arduino.cc/en/main/software获取它。
现在,您需要执行以下步骤才能使用Arduino IDE配置ESP8266:
1.启动Arduino IDE并打开“首选项”窗口。
2.在其他Board Manager URL中输入以下URL:http://arduino.esp8266.com/stable/package_esp8266com_index.json
3.从Tools |中打开Boards Manager Board菜单并安装esp8266平台,如下所示:

将模块连接到Wi-Fi网络
现在,我们将检查ESP8266和Arduino IDE是否正常工作,并将芯片连接到本地Wi-Fi网络。
为此,让我们执行以下步骤:
1.首先,我们需要编写代码然后将其上传到电路板。 代码很简单; 我们只想连接到本地Wi-Fi网络并打印电路板的IP地址。这是连接到网络的代码:

#include <ESP8266WiFi.h>
void setup() {
// put your setup code here, to run once:
const char* ssid = "203";
const char* password = "203forever";
// Start Serial
Serial.begin(115200);
// Connect to WiFi
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(http://www.my516.com));
}
void loop() {
// put your main code here, to run repeatedly:

}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

1

---------------------

Arduino与NodeMCU——联网

原文:https://www.cnblogs.com/ly570/p/11102762.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!