当前位置:网站首页>Embedded software development stm32f407 buzzer standard library version
Embedded software development stm32f407 buzzer standard library version
2022-07-16 06:33:00 【[email protected]】
Hardware
Punctual atomic Explorer STM32F407ZGT6


Software
1、Keil uVision5
Code
1、beep.c Key code in
void BEEP_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
// Can make GPIOF The clock
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOF,ENABLE);
// Initialize the corresponding pin of buzzer GPIOF8
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;
// Normal output mode
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
// Push pull output
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
//100MHz
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
// The drop-down
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;
// initialization GPIO
GPIO_Init(GPIOF,&GPIO_InitStructure);
// Turn off the buzzer : Buzzer corresponding pin GPIOF8 Pull it down
GPIO_ResetBits(GPIOF,GPIO_Pin_8);
}
2、main.c Key code in
int main(void)
{
delay_init(168); // Initialization delay function
LED_Init(); // initialization LED port
BEEP_Init(); // Initialize the buzzer port
while(1)
{
// DS0 Pull it down , bright equivalent LED0=0;
GPIO_ResetBits(GPIOF,GPIO_Pin_9);
// DS1 Pull it down , bright
LED1=0;
//BEEP The pins are pulled up , equivalent BEEP=1;
GPIO_SetBits(GPIOF,GPIO_Pin_8);
// Time delay 300ms
delay_ms(300);
// DS0 pull up , destroy equivalent LED0=1;
GPIO_SetBits(GPIOF,GPIO_Pin_9);
// DS1 pull up , destroy
LED1=1;
//BEEP Pin down , equivalent BEEP=0;
GPIO_ResetBits(GPIOF,GPIO_Pin_8);
// Time delay 300ms
delay_ms(300);
}
}
The code download
Embedded software development STM32F407 Buzzer LED The lamp Standard library version
Reference link
版权声明
本文为[[email protected]]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/197/202207131735084150.html
边栏推荐
- 【信号调理】ADC保护电路/ADC缓冲器
- 第二章 SYN6288语音合成模块的使用
- [Verilog] sub module connection related problems (adder and Its Optimization)
- 电脑常规操作
- codeblocks的官网下载与安装
- Catching both gray and black swans: open set supervised anomaly detection
- 含可变长参数的函数的使用(C语言<stdarg.h>)
- STM32 learning (Introduction)
- 【云原生|中间件】开源 SPL 轻松应对 T+0
- Visual Studio 2019 新建OpenGL项目无需重新配置环境
猜你喜欢

DHT11和DHT22(AM2302)比较及使用方法

V4l2 operation process and interface description

Max3232ese problem record and solution

【信号调理】精密检波电路和PCB示例
![[Multisim] problems and solutions of Multisim Simulation](/img/86/816ff7565f7f07cc9b36dc2449b289.png)
[Multisim] problems and solutions of Multisim Simulation "op amp integrator"
![[paper notes] - gan-2014-nips](/img/2a/4955c2d3755b72eff1185bc0402621.png)
[paper notes] - gan-2014-nips
![[paper notes] - dark video enhancement supervised stablllve network 2021-cvpr](/img/c4/03fe87012e4b9a40a81ce99aad7ee1.png)
[paper notes] - dark video enhancement supervised stablllve network 2021-cvpr
![[paper notes] - googlenet (inception-v1) - 2015-cvpr](/img/fc/c262ac8000c7fd4181daa557453560.png)
[paper notes] - googlenet (inception-v1) - 2015-cvpr

Visual Studio 2019 新建OpenGL项目无需重新配置环境

第三章 LD3320语音识别模块的使用
随机推荐
V4l2 operation process and interface description
typedef和define具体的具体差别
RT_thread邮箱的使用
【信号调理】【PCB】电源板(提供±2v5,3v3,5v,12v供电)的制作——电赛使用
【信号调理】精密检波电路和PCB示例
HDU 1914 The Stable Marriage Problem (稳定婚姻匹配)
Win10机器学习环境搭建—pycharm、anaconda、pytorch
SQL中去除重复数据的几种方法,我一次性都告你
Max3232ese problem record and solution
C语言宏定义(宏参数创建字符串、预处理粘合剂)
CPU及内存占用过高,如何修改RTSP轮巡检测参数以降低服务器消耗?
Dhcp-master Automated Deployment
HDU 3592 World Exhibition (差分约束)
C语言位操作(适用于操作单片机寄存器)
DHT11和DHT22(AM2302)比较及使用方法
关于物联网毕设须知
[paper notes] - millimeter wave radar fog penetrating high resolution imaging - supervised Hawkeye system - 2020-cvpr
【Multisim】关于Multisim仿真“运放积分器”出现的问题以及解决方法
数据不平衡:反欺诈模型(数据不平衡)综合采样
RT_thread信号量的使用