这篇讲一下嵌入式,用的ESP8266,拿的原子哥的例程修改的。
keil里面的注释复制过来就不行了,见谅。
void atk_8266_wifista_test(void)
{
u8 count = 0;
u8 *p = "Aclient"; //uid
atk_8266_send_cmd("AT+CWMODE=1","OK",50);
atk_8266_send_cmd("AT+RST","OK",20);
delay_ms(1000); ¦
delay_ms(1000);
delay_ms(1000);
delay_ms(1000);
LCD_ShowString(60,50,200,16,16,"connecting");
while(atk_8266_send_cmd("AT+CWJAP=\"iPhone\",\"jwl123..\"","WIFI GOT IP",300));
LCD_ShowString(60,80,200,16,16,"connect");
delay_ms(1000);
delay_ms(1000);
atk_8266_send_cmd("AT+CIPMUX=0","OK",20); //单连接
delay_ms(1000);
delay_ms(1000);
delay_ms(1000);
LCD_ShowString(60,110,200,16,16,"TCP connectting");
//连接路由
while(atk_8266_send_cmd("AT+CIPSTART=\"TCP\",\"120.79.254.76\",10004","OK",200))
{
count++;
LCD_ShowString(60,140,200,16,16,"TCP failed");
}
LCD_ShowString(60,170,200,16,16,"TCP OK");
atk_8266_quit_trans(); //退出透传
atk_8266_send_cmd("AT+CIPSEND","OK",20); //开启透传
LCD_ShowString(60,50,200,16,16,"ok");
u3_printf("%s",p); //配置uid号
USART3_RX_STA=0;
}
下一篇说一下安卓部分