当前位置:网站首页>学习太极创客 — 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 功能的局限性

边栏推荐
- A tip to read on Medium for free
- IDEA另起一行快捷键
- What is SRE? A detailed explanation of SRE operation and maintenance system
- threejs辉光通道01(UnrealBloomPass && layers)
- pm2 部署 nuxt3.js 项目
- One article explains in detail | those things about growth
- 4275. Dijkstra sequence
- 【LeetCode】387. 字符串中的第一个唯一字符
- Liunx change the port number of vsftpd
- Data midrange: detailed explanation of the technical stack of data acquisition and extraction
猜你喜欢

深入了解 border

华为路由器:GRE技术

YOLOX backbone——CSPDarknet的实现

Ordinary people have no education background. Can they earn more than 10000 yuan a month by Self-taught programming?

【量化投资】离散傅里叶变换求数组周期

Kaformer personal notes

cookie加密 4 rpc方法确定cookie加密

【LeetCode】541. 反转字符串 II

Become an IEEE student member

MySQL | view notes on Master Kong MySQL from introduction to advanced
随机推荐
1528. rearrange strings
[redis implements seckill business ①] seckill process overview | basic business implementation
关于 GIN 的路由树
pm2 部署 nuxt3.js 项目
【牛客】把字符串转换成整数
Spark - LeftOuterJoin 结果条数与左表条数不一致
【Pytorch基础教程31】YoutubeDNN模型解析
Leetcode -- wrong set
[Niuke] convert string to integer
Determination of monocular and binocular 3D coordinates
[redis realize Secondary killing Business ①] Overview of Secondary killing Process | Basic Business Realization
eBanb B1手环刷固件异常中断处理
Qingcloud based R & D cloud solution for geographic information enterprises
opencv最大值滤波(不局限于图像)
1704. 判断字符串的两半是否相似
Double pointer analog
金仓KFS replicator安装(Oracle-KES)
PM2 deploy nuxt3 JS project
How to configure environment variables and distinguish environment packaging for multi terminal project of uniapp development
快慢指针系列