找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 4119|回复: 4
收起左侧

esp8266连不上wifi

[复制链接]
ID:190584 发表于 2017-4-20 10:49 | 显示全部楼层 |阅读模式
        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,不知道是什么问题
捕获.JPG
回复

使用道具 举报

ID:240820 发表于 2018-1-6 15:31 | 显示全部楼层
这个程序当把这个单片机接上的时候  手机app 不能连接wifi 为什么
回复

使用道具 举报

ID:240820 发表于 2018-1-6 15:54 | 显示全部楼层
一直在发AT命令 然后APP会断开怎么让手机断wifi的连接不断开
回复

使用道具 举报

ID:272453 发表于 2018-1-6 18:30 | 显示全部楼层
重新用CWJAP链接一下
回复

使用道具 举报

ID:272453 发表于 2018-1-6 18:32 | 显示全部楼层
重新CWJAP连接一下试试
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表