void _wifiap_test(void)
{
u8 *p;
LCD_ShowString(50,30,200,16,16,"WIFI_TEST....");
while(atk_8266_send_cmd("AT","OK",20))//检查WIFI模块是否在线
{
atk_8266_quit_trans();//退出透传
atk_8266_send_cmd("AT+CIPMODE=0","OK",200); //关闭透传模式
LCD_ShowString(50,30,200,16,16,"Without_WIFI_");
delay_ms(800);
LCD_ShowString(50,30,200,16,16,"Try_again_...");
}
while(atk_8266_send_cmd("ATE0","OK",20));//关闭回显
delay_ms(10);
atk_8266_at_response(1);//检查ATK-ESP8266模块发送过来的数据,及时上传给电脑
atk_8266_send_cmd("AT+CIPMODE=2","OK",200); //传输模式为:AP模式
sprintf((char*)p,"AT+CWSAP=\"%s\",\"%s\",1,4",wifiap_ssid,wifiap_password); //配置模块AP模式无线参数
atk_8266_send_cmd(p,"OK",1000);
atk_8266_send_cmd("AT+CIPMUX=1","OK",20); //0:单连接,1:多连接
sprintf((char*)p,"AT+CIPSERVER=1,%s",(char*)portnum);
atk_8266_send_cmd(p,"OK",20); //开启Server模式,端口号为8086
atk_8266_send_cmd("AT+CIPSEND=0,25","OK",200); //发送指定长度的数据
LCD_ShowString(50,30,200,16,16,"WIFI_OK......");
}
在 这里一直循环{ while(atk_8266_send_cmd("AT","OK",20))//检查WIFI模块是否在线}
|