224【Complete Course Design】Smart Trash Can Design Based on 51 Single Chip Computer-Infrared Obstacle Avoidance

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

51 smart trash can design-infrared obstacle avoidance-toggle-relay-infrared pair tube-wt588d-photosensitive-LED

This design consists of STC89C52 single-chip circuit + toggle switch circuit + infrared obstacle avoidance sensor + relay circuit + infrared pair tube circuit + WT588D voice module circuit + photoresistor circuit + LED lamp circuit + power supply circuit.

1. Select the working mode by flipping the switch. Turn the toggle switch 1 up to the automatic mode, and down to the manual mode.

2. Manual mode: Turn the toggle switch 2 up, the relay is closed, dial down, and the relay opens.

3. Automatic mode: the obstacle avoidance infrared sensor detects the obstacle, the relay closes, the obstacle avoidance infrared sensor detects the obstacle 1 does not detect the obstacle, the relay opens.

4. If the infrared pair tube detects an obstacle, the voice module WT588D will prompt the trash can to be full. Otherwise, the voice module does not broadcast any information.

5. The light is off during the day, and the light is on at night.

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

sbit led=P1^0; //定义引脚值
sbit ligh=P1^1;
sbit yuyin=P1^2;
sbit relay=P1^3;
sbit duiguan =P1^4;
sbit hot=P1^5;
sbit sw_mode = P1^6;
sbit sw_kgsw= P1^7;

void Init_Timer0(void);		 //函数声明
void SendStr(unsigned char *s,unsigned char length);
void UART_Init(void);
void SendByte(unsigned char dat);

unsigned long time_20ms=0;	  	//定时器定时
unsigned int yyLater  = 0;//语音延时计数

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

 

Guess you like

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