当前位置:网站首页>基于STM32F103的消防系统之驱动电机风扇
基于STM32F103的消防系统之驱动电机风扇
2022-07-30 05:47:00 【计算机小袁】
硬件材料
开发板 野火STM32-F103指南者

R300电机风扇模块

引脚连接

代码简介
本驱动电机通过电信号控制开关,并未设置PWM进行调速。
软件代码
.C文件
#include "feng.h"
#include "stm32f10x.h"
void FENG_Config(void)
{
/*定义一个GPIO_InitTypeDef类型的结构体*/
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd( FENG_GPIO_CLK, ENABLE);
GPIO_InitStructure.GPIO_Pin = FENG_GPIO_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(FENG_GPIO_PORT, &GPIO_InitStructure);
GPIO_ResetBits(FENG_GPIO_PORT, FENG_GPIO_PIN);
}
/*********************************************END OF FILE**********************/.H文件
#ifndef __FENG_H
#define __FENG_H
#include "stm32f10x.h"
/* 定义电机风扇连接的GPIO端口, 用户只需要修改下面的代码即可改变控制的电机风扇引脚 */
#define FENG_GPIO_PORT GPIOC /* GPIO端口 */
#define FENG_GPIO_CLK RCC_APB2Periph_GPIOC /* GPIO端口时钟 */
#define FENG_GPIO_PIN GPIO_Pin_8 /* 连接到电机风扇的GPIO */
/* 带参宏,可以像内联函数一样使用 */
#define FENG(a) if (a) \
GPIO_SetBits(FENG_GPIO_PORT,FENG_GPIO_PIN);\
else \
GPIO_ResetBits(FENG_GPIO_PORT,FENG_GPIO_PIN)
void FENG_Config(void);
#endif /* __BEEP_H */
main.c
GPIO_ResetBits(FENG_GPIO_PORT, FENG_GPIO_PIN); //开启风扇
GPIO_SetBits(FENG_GPIO_PORT, FENG_GPIO_PIN); //关闭风扇本模块可以和MQ-4天然气模块结合使用,用电机风扇模拟排风扇。
本模块较为简单,篇幅过短。
下面内容请忽略!
此文章质量较低,不会获得较多流量扶持! 可能的原因为:篇幅太短,广告涉嫌违规,外链过多,缺少代码,图片涉嫌违规。此文章质量较低,不会获得较多流量扶持! 可能的原因为:篇幅太短,广告涉嫌违规,外链过多,缺少代码,图片涉嫌违规。此文章质量较低,不会获得较多流量扶持! 可能的原因为:篇幅太短,广告涉嫌违规,外链过多,缺少代码,图片涉嫌违规。
边栏推荐
- Acwing刷题第一节
- QT weekly skills (3)~~~~~~~~~ serial port addition
- NS3报错 fatal error: ns3/opengym-module.h: No such file or directory
- 【已解决:el-input标签无法输入或不显示文字】
- 测试第二题
- Deep Interpretation of void (*signal(int , void(*)(int)))(int) in "C Traps and Defects"
- IEEE在指定期刊下搜索相关论文
- Real-time waveform display of CAN communication data based on QT (serial eight) ==== "Sub function or new class calls ui control"
- 华秋第八届硬创赛与安创加速器达成战略合作,助力硬科技项目成长
- Vim查找字符
猜你喜欢

数码管动态显示及模块化编程

Kunlun State Screen Production (serialization 4) --- Basics (graphical setting and display, button lights)

xxx is not in the sudoers file.This incident will be reported error
![[Jiangsu University of Science and Technology Automation Association stm32F103c8t6] Notes [Initial 32 MCU and TIM timing interrupt initialization parameter configuration]](/img/22/9c0dd4390a98fa2aa4e45164c078cc.png)
[Jiangsu University of Science and Technology Automation Association stm32F103c8t6] Notes [Initial 32 MCU and TIM timing interrupt initialization parameter configuration]

IEEE在指定期刊下搜索相关论文

VsCode连接远程服务器并修改文件代码

vscode set sublime theme

Real-time waveform display of CAN communication data based on QT (serial eight) ==== "Sub function or new class calls ui control"

this的指向问题
![[Jiangsu University Automation Association stm32F103c8t6] Notes [Initial 32 MCU and EXTI External Interrupt Initialization Parameter Configuration]](/img/e5/87cf293ac3d0c613864e99a8fe9a47.png)
[Jiangsu University Automation Association stm32F103c8t6] Notes [Initial 32 MCU and EXTI External Interrupt Initialization Parameter Configuration]
随机推荐
二进制到汇编:进制,原码反码补码,位运算,通用寄存器,内存一套打通
Delete all files containing a keyword in the current path
Explore the efficiency of make_shared
TCP为什么要三次握手,握手过程中丢包会怎么样?
给Vscode配置ESlint语法检查 — ESLint 插件自动格式化设置(实现Ctrl+S 按照ESLint规则自动格式化代码)
三种内核结构---宏内核、微内核、混合内核
[Jiangsu University Self-Chemistry Association stm32F103c8t6] Notes [Introduction to 32 MCUs and Using TIM Output to Compare and Configure PWM]
2020-09-03解决pip install安装非常慢[Errno 101] 网络不可达问题
vs compile boost library script
迷宫问题----经典回溯法解决
c语言编程练习
爬楼梯C语言
QT serial and CAN dynamic real-time display the log data
服务器基础知识:包含基本概念,作用,服务器选择,服务器管理等(学习来自米拓建站)
租用服务器训练yolov3模型
你不知道的JS语法篇笔记
Kunlun state screen production (serial 3) - based article (button serial port to send)
Massive remote sensing data processing and application of GEE cloud computing technology [basic, advanced]
动态规划进阶 JS
华秋电子成为开放原子开源基金会openDACS捐赠人,共建 openDACS开源生态