1.简介
本次没有用到模拟量采集,声音传感器听到声音,产生电平去点灯就可以了,可以自己去调节精度,不用太过灵敏
电源:5V 地:GND 引脚:PC11
流水灯:PC0 PC1 PC2
2.代码
voice.h
#ifndef __VOICE_H
#define __VOICE_H
#include "stm32f1xx_hal.h"
#define VOICE_GPIO_PORT GPIOC
#define VOICE_GPIO_PIN GPIO_PIN_11
#define VOICE_GPIO_CLK_ENABLE() do{ __HAL_RCC_GPIOC_CLK_ENABLE(); }while(0) /* PA口时钟使能 */
#define VOICE HAL_GPIO_ReadPin(VOICE_GPIO_PORT,VOICE_GPIO_PIN)
void VoiceSensor_Init(void);
uint8_t VoiceSensor_Get(void);
#endif
voice.c
#include "./BSP/VOICE/voice.h"
#include "stm32f1xx_hal.h"
void VoiceSen