221 [Complete Course Design] Design of Smart Stroller Based on 51 Single Chip Microcomputer-Sound-Music

[Resource Download] The download address is as follows:
https://docs.qq.com/doc/DTlRSd01BZXNpRUxl

51 Smart Stroller Design-Sound-Music Film-relay-TP4056-Photosensitive-Electromagnetic Lock-Toggle

The design consists of STC89C52 single-chip circuit + sound sensor circuit + music film control circuit + in-position switch + relay control circuit + solar lithium battery charging circuit + photoresistor module circuit + fan circuit + electromagnetic lock control circuit.

1. Detect whether there is sound through the sound sensor. If the sound exceeds the threshold, the music chip will play music and the relay will be closed. (Note: The sound sensor does not work when the music film is playing. When the music playback ends, the sound sensor works again. The music is played for 10 seconds, and the relay is closed and disconnected for 10 seconds).

2. When the sound sensor does not detect the sound, the toggle switch is turned down and the relay is disconnected. When the toggle switch is turned on, the relay is closed.

3. Solar panels supply power to the entire system. The system is powered by a lithium battery.

4. Detect whether there is wind through the fan, and detect day and night through the photoresistor module. During the day, the electromagnetic lock is opened, and at night when there is wind. When there is no wind at night, the electromagnetic lock is closed.

#include<reg52.h> //包含头文件,一般情况不需要改动,头文件包含特殊功能寄存器的定义
#include<stdio.h>
#include "delay.h"

sbit feng = P1^0; //引脚定义
sbit sound = P1^1; 
sbit yy = P1^2; 
sbit sw = P1^3; 
sbit relay = P1^4; 
sbit ligh = P1^5; 
sbit dcs = P1^6; 

unsigned char soundFlag = 0;   //检测声音标志
unsigned char soundCount = 0;  //声音计数延时
unsigned char soundLater = 0; //声音单次延时处理

unsigned char cfLater = 0; //触发时间

unsigned long time_20ms=0;		   //定时器计数

void Init_Timer0(void);

void main (void)
{     
	Init_Timer0();        //定时器0初始化

	DelayMs(200);          //延时有助于稳定
	while (1)         //主循环

 

Guess you like

Origin blog.csdn.net/theroadon/article/details/109232107