资源简介
基于stm32芯片的人体红外感应,当人经过,红外检测器检测到红外线时,输出端输出高电平,通过芯片控制夜灯点亮,同时控制灯亮的时间。

代码片段和文件信息
/**
******************************************************************************
* @file
* @author
* @version V1.0
* @date 2015.4.23
* @brief 人体红外感应 文件
******************************************************************************
* @attention
*
* @platform:
*
******************************************************************************
*/
#include “bodyinduction.h“
#include “include.h“
int BodyInduction;
/*******************************************************************************
* Function Name :
* Description : 人体红外感应 引脚的配置
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void Body_Configuration(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd( BODY_RCC_CLKENABLE);
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD;//感应高电平,是输入下拉吧
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_Pin = BODY_GPIO_Pin;
GPIO_Init(BODY_GPIO_PORT&GPIO_InitStructure);
}
/*******************************************************************************
* Function Name :
* Description : 人体红外感应函数,当感应到人,输出高电平,并将全局变量BodyInduction置1
否则置0;
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void Run_Induction(void)
{
if(1 == GPIO_ReadInputDataBit(BODY_GPIO_PORTBODY_GPIO_Pin) ) BodyInduction=1;
else BodyInduction=0;
}
/*******************************************************************************
* Function Name :
* Description : 判断,全局变量BodyInduction 为1 时,运行程序
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void Run_BodyInduction_Action(void)
{
if(1==BodyInduction)
{
printf(“BodyInduction“);
PlayDemoSound_mp3(“jg.mp3“1);
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2015-04-25 16:22 红外人体感应器\
文件 2316 2015-04-25 09:43 红外人体感应器\bodyinduction.c
文件 591 2015-04-25 09:41 红外人体感应器\bodyinduction.h
相关资源
- 基于stm32f103ve的程序——跑马灯实验
- 基于STM32RCT6的步进电机驱动程序
- stm32f407上的两个can发送和接收例程
- STM32 led 时钟
- STM32 2.4G通信例程
- 直流无刷电机方波驱动 stm32 例程代码
- STM32中文资料
- STM32蓝牙和串口程序
- STM32f103超声波模块例程
- stm32f103c8t6 4 oled.rar
- stm32f030 IAP Demo(原创)
- STM32基于rt_thread操作系统的SDHC卡文件
- NRF24L01实现51与STM32双向通讯
- STM32F103 串口程序(完整版)
- stm32 ds18b20 温度传感器 测试通过
- stm32官方例程
- STM32F103定时器中断程序
- [免费]基于stm32f103ze 的OLED驱动代码
- STM32F103RBT6驱动UC1698控制芯片的160160黑
- STM32F103 DS18B20 V3.5.0固件库驱动程序工
- STM32定时器使用入门。看了这个程序会
- SIM908 SDIO FSMC STM32 FIFO
- STM32F103 CC2500完整驱动(模拟SPI)
- AD7606采集程序
- stm32 用SPI 方式读写 SDHC
- stm32通过DMA方式采集ADC数据
- 意法半导体STM全系列微控制器STM32ST
- 基于STM32芯片的SX1278 驱动 LORA.rar
- STM32的PCB封装库,以及原理图库,48
- SX1280.rar
评论
共有 条评论