光敏电阻控制蜂鸣器
This commit is contained in:
25
User/main.c
25
User/main.c
@@ -1,22 +1,17 @@
|
||||
#include "stm32f10x.h"
|
||||
#include "Delay.h"
|
||||
#include "LED.h"
|
||||
#include "Key.h"
|
||||
|
||||
#include "Buzzer.h"
|
||||
#include "LightSensor.h"
|
||||
uint8_t KeyNum;
|
||||
int main(void){
|
||||
|
||||
LED_Init();
|
||||
Key_Init();
|
||||
while(1){
|
||||
|
||||
KeyNum = Key_GetNum();
|
||||
if (KeyNum == 1) {
|
||||
LED0_TOGGLE();
|
||||
int main(void) {
|
||||
Buzzer_Init();
|
||||
LightSensor_Init();
|
||||
while (1) {
|
||||
if (LightSensor_Read() == 1) {
|
||||
Buzzer_ON();
|
||||
} else {
|
||||
Buzzer_OFF();
|
||||
}
|
||||
if (KeyNum == 2) {
|
||||
LED1_TOGGLE();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user