当前位置:网站首页>Arduino interrupt realizes rising edge detection and executes other functions
Arduino interrupt realizes rising edge detection and executes other functions
2022-07-24 03:29:00 【The most important thing is to persist and never forget your or】
One 、 Corresponding procedure
int ledPin = 13; // LED Connected to digital pin 13
int PPS = 2; // GNSS From the receiver PPS Pulse signal Access port
int PWM_20HZ = 3; // 20hz Pulse port of frequency - Trigger the camera
int PWM_200HZ = 11; // 200hz Pulse port of frequency - to IMU Trigger
void setup()
{
pinMode(ledPin, OUTPUT);
pinMode(PWM_20HZ, OUTPUT);
pinMode(PWM_200HZ, OUTPUT);
pinMode(PPS,INPUT_PULLUP); // Set the key to input mode , Pull up inside
attachInterrupt(0, PWMProgram, RISING); // The rising edge triggers the interrupt 0, call testProgram function
}
void PWMProgram()
{
TCCR2A = _BV(COM2A1) | _BV(COM2B1) | _BV(WGM20);
TCCR2B = _BV(CS22);
OCR2A = 180;
OCR2B = 50;
}
void loop()
{
}shortcoming : The frequency cannot be adjusted arbitrarily
边栏推荐
- FTP服務與配置
- Why do some people write code so complicated?
- Basic use of Pinia
- 数据湖:开源数据湖方案DeltaLake、Hudi、Iceberg对比分析
- Idea failed to load resource: the server responded with a status of 404 (not found)
- B. Eastern Exhibition- Codeforces Round #703 (Div. 2)
- MySQL sub database and sub table and its smooth expansion scheme
- uva1344
- Huawei then responded to the rumor of "cleaning up employees over the age of 34". How can programmers cope with the "35 year old crisis"?
- Correct usage of iota in golang
猜你喜欢

实现两个页面之前的通信(使用localStorage)

数据湖:Apache Hudi简介

Web3 traffic aggregation platform starfish OS gives players a new paradigm experience of metauniverse

Ways to improve the utilization of openeuler resources 01: Introduction

Why do some people write code so complicated?

OSPF comprehensive experimental configuration

FTP service and configuration

拉格朗日插值法

JS 数组 isAarray() typeof

轮播图van-swipe的报错:cannot read a properties of null(reading width)
随机推荐
B. Eastern Exhibition- Codeforces Round #703 (Div. 2)
Basic syntax of MySQL DDL and DML and DQL
uva1344
C. Minimum Ties-Educational Codeforces Round 104 (Rated for Div. 2)
leetcode hot 100(刷题篇8)(232/88/451/offer10/offer22/344/)
How to write selenium's testng.xml
Services et configurations FTP
SolidWorks cannot reference references
It's solved with a cry
Lagrange polynomial
Jump statement in day011 loop structure
A simple and perfect WPF management system framework source code
How emqx 5.0 under the new architecture of mria + rlog realizes 100million mqtt connections
Do you know how to do interface testing well?
Talk about the application of FIFO
A series of problems of dp+ backtracking segmentation palindrome string
轮播图van-swipe的报错:cannot read a properties of null(reading width)
Write code, and multiple characters move from both ends to converge in the middle
How to implement desktop lyrics in pyqt
Insist on accompanying study