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

边栏推荐
- 【LeetCode】387. First unique character in string
- 【MySQL从入门到精通】【高级篇】(一)字符集的修改与底层原理
- 剑指 Offer 55 - I. 二叉树的深度-dfs法
- 华为路由器:GRE技术
- Threejs glow channel 01 (unrealbroompass & layers)
- Solving linear equations with MATLAB ax=b
- Matlab camera calibrator camera calibration
- Transplantation of xuantie e906 -- fanwai 0: Construction of xuantie c906 simulation environment
- A tip to read on Medium for free
- 数据中台:中台架构及概述
猜你喜欢

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

I heard that you are still spending money to buy ppt templates from the Internet?

基于QingCloud的 “房地一体” 云解决方案

【ES6闯关】Promise堪比原生的自定义封装(万字)

leetcode——错误的集合

Wan Weiwei, a researcher from Osaka University, Japan, introduced the rapid integration method and application of robot based on WRS system

听说你还在花钱从网上买 PPT 模板?

Opencv maximum filtering (not limited to images)
![[use picgo+ Tencent cloud object to store cos as a map bed]](/img/14/d650960cc77385504ea5e2e138bd46.jpg)
[use picgo+ Tencent cloud object to store cos as a map bed]

Opencv daily function structure analysis and shape descriptor (7) finding polygon (contour) / rotating rectangle intersection
随机推荐
Unable to change the virtual machine power status and report an error solution
pm2 部署 nuxt3.js 项目
China chip Unicorn Corporation
[noi simulation] pendulum (linear algebra, Du Jiao sieve)
关于 GIN 的路由树
[Niuke] convert string to integer
[e325: attention] VIM editing error
IDEA另起一行快捷键
Target detection series fast r-cnn
玄铁E906移植----番外0:玄铁C906仿真环境搭建
什么是图神经网络?图神经网络有什么用?
华为路由器:GRE技术
[redis implements seckill business ①] seckill process overview | basic business implementation
The list of open source summer winners has been publicized, and the field of basic software has become a hot application this year
Data midrange: analysis of full stack technical architecture of data midrange, with industry solutions
Huawei Router: GRE Technology
[MySQL from introduction to mastery] [advanced part] (I) character set modification and underlying principle
Data middle office: detailed explanation of technical architecture of data middle office
陆奇:我现在最看好这四大技术趋势
Fast and slow pointer series