当前位置:网站首页>ESP8266-Arduino编程实例-定时器与中断
ESP8266-Arduino编程实例-定时器与中断
2022-07-28 20:11:00 【视觉&物联智能】
定时器与中断
ESP8266 Timer0和Timer1有两个计时器,其WiFi功能使用一个定时器。我们只能使用一定计时器。为避免崩溃问题,在Arduino框架中建议使用Ticker而不是Timer。 Ticker执行与计时器相同的功能。
本实例将演示如何使用定时器及中断实现LED闪烁。
定时器的速度计算公式如下:
定时器速度(Hz) = 定时器时钟速度(Mhz) / 预分频器
预分频器/分频器是将上述频率除以形成定时器的“滴答(tick)”(增加其计数器)。 然后将 ISR 配置为在特定数量的滴答数后触发。
使用了预分频器,因为定时器最多只能在其计数器中存储 8/16 位,这意味着对于 8 位计数器,它们将每 256/16000000 秒(16us)溢出,对于 16 位计数器,它们将每 65536 / 16000000 秒(4us)溢出 ,这通常远远超过需要。 预分频器允许对其进行缩放以允许更长的间隔。
1、硬件准备
- ESP8266 NodeMCU开发板一块
- LED一个
- 470欧姆电阻一个
- 杜邦线若干
- 数据线一条
2、软件准备
- Arduino IDE或VSCode + PlatformIO
在前面的文章中,对如何搭建ESP8266开发环境做了详细的介绍,请参考:
边栏推荐
- RHCSA第一天
- Wechat applet development company, do you know how to choose?
- 物联网技术栈之网关技术
- Cy3/Cy5/Cy5.5/Cy7荧光标记抗体/蛋白试剂盒(10~100mg标记量)
- 不用Swagger,那我用啥?
- [brother hero July training] day 28: dynamic planning
- Detailed explanation of JVM memory layout (glory collection version)
- 怎样巧用断言+异常处理类,使代码更简洁!(荣耀典藏版)
- Library borrowing system "suggested collection"
- 中国农业工程学会农业水土工程专业委员会-第十二届-笔记
猜你喜欢

物联网技术栈之网关技术

基于Xception-TD的中华传统刺绣分类模型构建

聊一聊数据库的行存与列存

株洲市九方中学开展防溺水、消防安全教育培训活动

C语言入门【详细】

如何高效、精准地进行图片搜索?看看轻量化视觉预训练模型

Week 6 Linear Models for Classification (Part B)

Zhuzhou Jiufang middle school carried out drowning prevention and fire safety education and training activities

For the first time, Chinese scientists used DNA to construct convolutional artificial neural network, which can complete 32 types of molecular pattern recognition tasks, or be used for biomarker signa

Research on the recognition method of move function information of scientific paper abstract based on paragraph Bert CRF
随机推荐
openEuler Embedded SIG | 分布式软总线
Modify the port number of MySQL (is there a problem modifying the port number of MySQL)
开放式耳机哪个品牌好、性价比最高的开放式耳机排名
Apple M1 processor details: performance and energy efficiency have doubled, and Intel Core i9 is no match!
Open earphone which air conduction earphone with good sound quality and recognized sound quality is recommended
Wechat applet development company, do you know how to choose?
二 RedisTemplate的序列和反序列化机制讲解
Pytorch learning record (4): over fitting, convolution neural network CNN
Detailed explanation of JVM memory layout (glory collection version)
Library borrowing system "suggested collection"
Information fusion method and application of expert opinion and trust in large group emergency decision-making based on complex network
C process control statement
Matlab | basic knowledge summary I
Apifox:满足你对 Api 的所有幻想
详解visual studio 2015在局域网中远程调试程序
Vimtutor编辑
Openeuler embedded sig | distributed soft bus
Standard C language learning summary 10
An end-to-end aspect level emotion analysis method for government app reviews based on brnn
不用Swagger,那我用啥?