当前位置:网站首页>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开发环境做了详细的介绍,请参考:
边栏推荐
- Talk about row storage and column storage of database
- Divide and conquer, upload large files in pieces
- 二 RedisTemplate的序列和反序列化机制讲解
- World Hepatitis Day | grassroots can also enjoy the three a resources. How can the smart medical system solve the "difficulty of seeing a doctor"?
- 开放式耳机哪个品牌好、性价比最高的开放式耳机排名
- Professional Committee of agricultural water and soil engineering of China Association of Agricultural Engineering - 12th session - Notes
- How is nanoid faster and more secure than UUID implemented? (glory Collection Edition)
- C语言入门【详细】
- Construction of Chinese traditional embroidery classification model based on xception TD
- What technology is needed for applet development
猜你喜欢

Information fusion method and application of expert opinion and trust in large group emergency decision-making based on complex network

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

蚂蚁集团境外站点 Seata 实践与探索

微信小程序开发公司你懂得选择吗?

Lt7911d type-c/dp to Mipi scheme is mature and can provide technical support

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

技术选型Rust——事后分析

Save 70% of the video memory and increase the training speed by 2 times! Zheda & Ali proposed online convolution re parameterization orepa, and the code has been open source! (CVPR 2022 )

Meta opens the project aria pilot dataset and will develop real-time 3D maps in the future

LeetCode链表问题——142.环形链表II(一题一文学会链表)
随机推荐
开放式耳机哪个品牌好、性价比最高的开放式耳机排名
Leetcode linked list question - interview question 02.07. linked list intersection (learn linked list by one question and one article)
不用Swagger,那我用啥?
For the 1000 yuan 5g mobile phone market, MediaTek Tianji 700 released
For the next generation chromebook, MediaTek launched new chipsets mt8192 and mt8195
Matlab | basic knowledge summary I
小程序开发需要什么技术
比UUID更快更安全NanoID到底是怎么实现的?(荣耀典藏版)
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
Query Oracle view creation statement and how to insert data into the view [easy to understand]
Research on the recognition method of move function information of scientific paper abstract based on paragraph Bert CRF
OA项目之会议通知(查询&是否参会&反馈详情)
MySQL
Priced at 1.15 billion yuan, 1206 pieces of equipment were injected into the joint venture! Sk Hynix grabs the mainland wafer foundry market!
网格数据生成函数meshgrid
Introduction to C language [detailed]
微信小程序开发公司你懂得选择吗?
msfvenom制作主控与被控端
Explain the remote debugging program of visual studio 2015 in LAN
MySQL 是如何归档数据的呢?