|
memset(&RsBuf[1],' ',18);
Uart_init();
lcd_init();
delay(3000);
SendString("+++");
delay(500);
SendString("+++\r\n");
delay(500);
// write_1602com(0xc0);
// for(i=0;i<16;i++)
// write_1602dat(RsBuf[i+2]);
Rec_stop=0;
memset(&RsBuf[1],' ',18);
SendString("AT+CWMODE=1\r\n");
write_1602com(0x01);
write_string(0x80,"AT+CWMODE=1 ",0);
while(Rec_stop==0) ;
Rec_stop=0;
// write_1602com(0xc0);
// delay(1);
// for(i=0;i<2;i++)
// write_1602dat(RsBuf[i+2]);
delay(2000);
memset(&RsBuf[1],' ',18);
SendString("AT+RST\r\n");
write_1602com(0x01);
write_string(0x80,"AT+RST ",0);
while(Rec_stop==0&&RsBuf[0]!='W');
Rec_stop=0;
// write_1602com(0xc0);
// for(i=0;i<16;i++)
// write_1602dat(RsBuf[i+2]);
delay(3000);
memset(&RsBuf[1],' ',18);
SendString("ATE0\r\n");
write_string(0x80,"ATE0 ",0);
write_string(0xc0," ",0);
while(Rec_stop==0) ;
Rec_stop=0;
// write_1602com(0xc0);
// delay(1);
// for(i=0;i<2;i++)
write_1602dat(RsBuf[i+2]);
delay(2000);
memset(&RsBuf[1],' ',18);
SendString("ATE0\r\n");
write_1602com(0x01);
write_string(0x80,"ATE0 ",0);
while(Rec_stop==0) ;
Rec_stop=0;
// write_1602com(0xc0);
// delay(1);
// for(i=0;i<2;i++)
// write_1602dat(RsBuf[i+2]);
delay(2000);
memset(&RsBuf[1],' ',18);
SendString("AT+CIPMUX=0\r\n");
write_1602com(0x01);
write_string(0x80,"AT+CIPMUX=0 ",0);
while(Rec_stop==0);
Rec_stop=0;
// write_1602com(0xc0);
// for(i=0;i<2;i++)
// write_1602dat(RsBuf[i+2]);
delay(100);
memset(&RsBuf[1],' ',18);
SendString("AT+CIPSTART=\"TCP\",\"114.215.204.246\",9999\r\n");
//SendString("AT+CIPSTART=TCP,114.215.204.246,9999\r\n");
write_1602com(0x01);
write_string(0x80,"AT+CISTART=TCP ",0);
while(Rec_stop==0&&RsBuf[2]=='O');
Rec_stop=0;
// write_1602com(0xc0);
// for(i=0;i<2;i++)
// write_1602dat(RsBuf[i+2]);
delay(2000);
memset(&RsBuf[1],' ',18);
SendString("AT+CIPMODE=1\r\n");
write_1602com(0x01);
write_string(0x80,"AT+CIPMODE=1 ",0);
while(Rec_stop==0);
Rec_stop=0;
// write_1602com(0xc0);
// for(i=0;i<2;i++)
// write_1602dat(RsBuf[i+2]);
delay(2000);
RsPoint=0;
memset(&RsBuf[1],' ',18);
SendString("AT+CIPSEND\r\n");
write_1602com(0x01);
write_string(0x80,"AT+CIPSEND ",0);
while(RsPoint==0);
// write_1602com(0xc0);
// for(i=0;i<16;i++)
// write_1602dat(RsBuf[i]);
delay(2000);
SendString("AT+CWJAP=\"wodewifi\",\"nidemima\"\r\n");
//在这里填入你的路由器名称和密码 分别替代wodewifi和 nidemima 双引号和斜杠不能删除
delay(5000);
wifi配置在这里,串口助手里很多乱码加上一直有wifi disconnected,不知道是什么问题 |
|