单片机源程序如下:
- #include "led.h"
- #include "delay.h"
- #include "sys.h"
- #include "usart.h"
- #include "lcd.h"
- #include "key.h"
- #include "usmart.h"
- #include "malloc.h"
- #include "MMC_SD.h"
- #include "ff.h"
- #include "exfuns.h"
- #include "fontupd.h"
- #include "text.h"
- #include "remote.h"
-
-
- int main(void)
- {
- u8 key,rain,i,infrared,hongwai;
- NVIC_Configuration();
- delay_init(); //延时函数初始化
- LCD_Init(); //初始化液晶
- LED_Init(); //LED初始化
- usmart_dev.init(72); //usmart初始化
- exfuns_init(); //为fatfs相关变量申请内存
- while(font_init()) //检查字库
- {
- LCD_Clear(WHITE); //清屏
- POINT_COLOR=RED; //设置字体为红色
- delay_ms(1500);
- LCD_Clear(WHITE);//清屏
- }
- Remote_Init();
- dianji_Init();
-
- POINT_COLOR=RED;
- Show_Str(80,80,200,16,"智能垃圾桶",16,0);
- POINT_COLOR=DARKBLUE;
- Show_Str(50,140,200,16,"制作人:郭*",16,0);
- Show_Str(116,160,200,16,"张* 雷*",16,0);
- Show_Str(50,200,200,16,"时间:2015.1.22",16,0);
- while(1)
- {
- rain=GPIO_ReadInputDataBit(GPIOC,GPIO_Pin_13);
- infrared=GPIO_ReadInputDataBit(GPIOC,GPIO_Pin_14);
- hongwai=GPIO_ReadInputDataBit(GPIOC,GPIO_Pin_15);
- if(infrared==1)
- {
- LCD_Clear(WHITE);
- Open_Dustbin();
- for(i=128;i>0;i--)
- {
- ZhengZhuan1(2);
- }
- delay_ms(80000);
- if(hongwai==1)
- {
- if(rain==0)
- {
- yeti();
- for(i=90;i>0;i--)
- {
- FanZhuan2(3);
- }
- delay_ms(100);
- for(i=90;i>0;i--)
- {
- ZhengZhuan2(3);
- }
- delay_ms(100);
- }
- else
- { ganzao();
- for(i=90;i>0;i--)
- {
- ZhengZhuan2(3);
- }
- delay_ms(100);
- for(i=90;i>0;i--)
- {
- FanZhuan2(3);
- }
- delay_ms(100);
- }
- }
-
- for(i=128;i>0;i--)
- {
- FanZhuan1(2);
- }
- }
-
- }
- }
复制代码
所有资料51hei提供下载:
智能垃圾桶.7z
(649.75 KB, 下载次数: 33)
|