新手上路
- 积分
- 27
- 金钱
- 27
- 注册时间
- 2019-4-28
- 在线时间
- 3 小时
|
1金钱
这是代码部分:
u8 *p;
p=mymalloc(SRAMIN,32); //éêÇë32×Ö½úÄú′æ
atk_8266_send_cmd("AT+CWMODE=1","OK",50); //WIFI STAÄ£ê½
delay_ms(1000);
delay_ms(1000);
atk_8266_send_cmd("AT+RST","OK",50);
delay_ms(1000);
delay_ms(1000);
delay_ms(1000); //μè′yÖØÆô
sprintf((char*)p,"AT+CWJAP=\"%s\",\"%s\"",wifista_ssid,wifista_password);//ssid,ÃüÂë
atk_8266_send_cmd(p,"WIFI GOT IP",300); //ᬽóÄ¿±ê·óéÆ÷
//TCP Client
atk_8266_send_cmd("AT+CIPMUX=0","OK",20); //0:μ¥á′½ó
sprintf((char*)p,"AT+CIPSTART=\"TCP\",\"192.168.1.101\",8080");
while(atk_8266_send_cmd(p,"OK",200));
atk_8266_send_cmd("AT+CIPMODE=1","OK",200);
//í¸′«
//·¢Ëíêy¾Y
USART3_RX_STA=0;
atk_8266_send_cmd("AT+CIPSEND","OK",20);
while(1){
u8 key=0;
key=KEY_Scan(0);
if(key==WKUP_PRES)//WK_UP ¶Ï¿aᬽó
{
sprintf((char*)p,"finish\n");
u3_printf("%s",p);
break;
}else
{
UID=readStm32UniqueID();
sprintf((char*)uid123,"%s",(u8 *)UID++);
for(int i=0;i<4;i++){
sprintf((char*)uid123+strlen((char *)uid123),"%s",(u8*)UID++);
}
sprintf((char*)p,"%s,%s\n",uid123,message);
u3_printf("%s",p);
}
}
myfree(SRAMIN,p); //êí·ÅÄú′æ
主要是传输message的数据
|
|