当前位置:网站首页>学习太极创客 — ESP8226 (十三)OTA
学习太极创客 — ESP8226 (十三)OTA
2022-06-24 07:37:00 【xuechanba】
视频链接: https://www.bilibili.com/video/BV1L7411c7jw?p=23&vd_source=b91967c499b23106586d7aa35af46413
资料链接:http://www.taichi-maker.com/homepage/esp8266-nodemcu-iot/iot-c/esp8266-tips/esp8266-ota/
所谓 OTA,就是 Over-The-Air 的缩写。有人将其翻译为“空中下载”,也有翻译为“隔空传输”。无论如何翻译,对于 ESP2866 来说,通过OTA我们无需将ESP8266与电脑连接,而仅仅通过 WiFi 就可以用 Arduino IDE 向 ESP8266 上传程序。
1 通过数据线上传初始示例程序
// An highlighted block
var foo = 'bar';
程序说明,
这段程序的主要功能是让 ESP8266 开发板上的 LED 产生一个闪烁的效果。这个闪烁效果的时间间隔是可以通过程序中的一个参数 blinkInterval 来进行设置的。除此之外,还增加了 OTA 功能。
主要说一下这个程序中的 OTA 部分,
在 setup 函数中,
// OTA设置并启动
ArduinoOTA.setHostname("ESP8266");
ArduinoOTA.setPassword("12345678");
ArduinoOTA.begin();
其中,ArduinoOTA.setHostname 函数的作用是让开发板在实现 OTA 功能时给其起一个名字,这个名字在 OTA 数据传输时将会看到。
ArduinoOTA.setPassword 函数的作用是设置密码的,当我们在用 OTA 功能向开发板上传程序时,需要进行密码认证。
之后,通过 ArduinoOTA.begin(); 开发板将启动 OTA 功能。
最后,在 loop 函数中,
void loop() {
ArduinoOTA.handle();
}
ArduinoOTA.handle();需要经常的被调用,目的是看有没有电脑向开发板发出程序上传的请求。
将程序通过数据线下载到 ESP8266 中后,启动串口监视器看下,
2 使用 OTA 功能重新上传上面的示例程序
之后,断开串口线,单独给开发板供电并重新启动 Arduino IDE ,然后,

点击该网络端口之后,
点击上传。

然后,就会出现

输入密码后,(如果有防火墙,点击确认)

然后,不用重启开发板,就可以直接看到程序运行效果了。
3 OTA 功能的局限性

边栏推荐
- 用VNC Viewer的方式远程连接无需显示屏的树莓派
- Prompt code when MySQL inserts Chinese data due to character set problems: 1366
- [Niuke] length of the last word of HJ1 string
- 解决:jmeter5.5在win11下界面上的字特别小
- [MySQL from introduction to mastery] [advanced part] (I) character set modification and underlying principle
- I heard that you are still spending money to buy ppt templates from the Internet?
- MBA-day25 最值问题-应用题
- cookie加密 4 rpc方法确定cookie加密
- Determination of monocular and binocular 3D coordinates
- From the Huawei weautomate digital robot forum, we can see the "new wisdom of government affairs" in the field of government and enterprises
猜你喜欢

110. balanced binary tree recursive method

Huawei Router: IPSec Technology

“不平凡的代理初始值设定不受支持”,出现的原因及解决方法

uniapp 开发多端项目如何配置环境变量以及区分环境打包

What is SRE? A detailed explanation of SRE operation and maintenance system

Database migration from PostgreSQL to MySQL
![[noi Simulation Competition] send (tree DP)](/img/5b/3beb9f5fdad00b6d5dc789e88c6e98.png)
[noi Simulation Competition] send (tree DP)

JS to find and update the specified value in the object through the key

4275. Dijkstra序列
![[redis realize Secondary killing Business ①] Overview of Secondary killing Process | Basic Business Realization](/img/a3/9a50e83ece43904a3a622dcdb05b3c.png)
[redis realize Secondary killing Business ①] Overview of Secondary killing Process | Basic Business Realization
随机推荐
Solution: Nan occurs in loss during model training
Data middle office: middle office practice and summary
【Redis实现秒杀业务①】秒杀流程概述|基本业务实现
陆奇:我现在最看好这四大技术趋势
1528. rearrange strings
华为路由器:GRE技术
GradScaler MaxClipGradScaler
threejs辉光通道01(UnrealBloomPass && layers)
Opencv daily function structure analysis and shape descriptor (7) finding polygon (contour) / rotating rectangle intersection
One article explains in detail | those things about growth
A tip to read on Medium for free
MySQL | store notes of Master Kong MySQL from introduction to advanced
Sword finger offer 55 - I. depth DFS method of binary tree
Fast and slow pointer series
Jincang KFS replicator installation (oracle-kes)
Prompt code when MySQL inserts Chinese data due to character set problems: 1366
Qingcloud based R & D cloud solution for geographic information enterprises
Data midrange: detailed explanation of the technical stack of data acquisition and extraction
[redis realize Secondary killing Business ①] Overview of Secondary killing Process | Basic Business Realization
华为路由器:ipsec技术