单片机技术网|技术阅读
登录|注册

您现在的位置是:单片机技术网 > 技术阅读 > 基于51单片机的WiFi的温湿度智能开关设计

基于51单片机的WiFi的温湿度智能开关设计

.

   湿wifiSTC89C51wifi


   51++LCD1602+湿+++LED++AT24C02+


.

1AT24c02

2

3LCD1602湿湿

4湿DHT110--50湿20%RH90%RH

5.

6湿.


.

1AD,

2Protues仿


3PCB

.

void main(){ char *str2="AT+CIPSEND=14\r\n"; unsigned char i; memset(&RsBuf[1],' ',18); Uart_init(); lcd_init(); wifi_init(); write_string(0x80,"Te: C Hu: %",0); //第一行显示字符串 write_string(0xc0,"STATUS:0000 ",0); //第二行显示字符串 write_1602com(0x85); //选中位置 write_1602dat(0xdf); //显示摄氏度的°
while(1) { if(FlagStart==1) { TR0=0; RH(); FlagStart = 0; write_1602com(0x83); //指定第一行第三个位置 write_1602dat(temperature%100/10+0x30); //显示温度的十位 write_1602dat(temperature%100%10+0x30); //显示温度个位 write_1602com(0x8d); //选中第一行第十三个位置 write_1602dat(humidity%100/10+0x30); //显示湿度十位 write_1602dat(humidity%100%10+0x30); //显示湿度个位 SendString("{\"UN\":\"yhdifiot024@163.com\",\"VER\":\"A1.1\",\"ID\":\"234103\",\"MAC\":\"18fe35f1cd4a\",\"TP\":\""); //784551388@qq.com是账号 234100是ID SendASC(temperature%100/10+0x30); //1 SendASC(temperature%10+0x30); //1 SendString("\",\"HM\":\""); // 8 SendASC(humidity%100/10+0x30); //1 SendASC(humidity%10+0x30); //1 SendString("\",\"SOC\":\"99\",\"RET\":\"1\"}\r\n"); TR0=1; Timer0_count=0; Timer0_miao=0; } write_1602com(0xc7); //选中第二行第七个位置 if(LED1) //如果LED1等于1 write_1602dat('0'); //显示0 else //LED1不等于1 write_1602dat('1'); //显示1 if(LED2) write_1602dat('0'); else write_1602dat('2'); if(LED3) write_1602dat('0'); else write_1602dat('3'); if(LED4) write_1602dat('0'); else write_1602dat('4');
delay(100); } }