1.直接上AT指令,测试过可用
注意回车换行,所有指令都有,有一些特殊的不需要,但是基本上都需要。下面的指令都需要回车换行。/r/n
[2024-01-27 02:47:23.374]
TX:AT
[2024-01-27 02:47:23.392]
RX:AT
OK
[2024-01-27 02:47:35.267]
TX:ATE0 //关闭回显,ATE1开启回显
[2024-01-27 02:47:35.271]
RX:ATE0
OK
[2024-01-27 02:47:45.628]
TX:AT
[2024-01-27 02:47:45.632]
RX:
OK
[2024-01-27 02:49:38.925]
TX:AT+GMR
[2024-01-27 02:49:38.930]
RX:AT version:1.7.0.0(Aug 16 2018 00:57:04)
SDK version:3.0.0(e27cf60)
compile time:Oct 30 2018 18:18:34
OK
[2024-01-27 02:50:23.244]
TX:AT+CWMODE=1 //STATION 模式
[2024-01-27 02:50:23.315]
RX:
OK
[2024-01-27 02:51:42.492]
TX:AT+CWJAP=“***","*******" //连接WiFi 名称和密码
[2024-01-27 02:51:46.559]
RX:WIFI CONNECTED
[2024-01-27 02:51:47.148]
TX:AT+CWJAP="****","******"
[2024-01-27 02:51:47.154]
RX:
busy p...
WIFI GOT IP
OK
[2024-01-27 02:52:10.757]
TX:AT+CIPMUX=0 //单连接
[2024-01-27 02:52:10.762]
RX:
OK
[2024-01-27 02:52:24.684]
TX:AT+CIFSR //查询ip和mac
[2024-01-27 02:52:24.689]
RX:+CIFSR:STAIP,"192.168.1.102"
+CIFSR:STAMAC,"98:cd:ac:3f:cd:f2"
OK
[2024-01-27 02:53:33.157]
TX:AT+HTTPINIT //无http协议栈,注意
[2024-01-27 02:53:33.162]
RX:
ERROR
[2024-01-27 03:09:38.485]
TX:AT+CIPSTART="TCP","api.yytianqi.com",80 //连接域名服务器(也可以是ip地址,只不过IP地址天天变化,毕竟免费的网站不会专门申请ip,都是代理,代理就会天天变),http80端口 https 443端口
[2024-01-27 03:09:38.619]
RX:CONNECT
OK
[2024-01-27 03:10:17.605]
TX:AT+CIPSEND=64 //发送64字节
[2024-01-27 03:10:17.610]
RX:
OK
> //等待输入
[2024-01-27 03:10:38.718]
RX:CLOSED //关闭
[2024-01-27 03:16:15.133]
TX:AT+CIPSTART="TCP","api.yytianqi.com",80
[2024-01-27 03:16:15.201]
RX:CONNECT
OK
[2024-01-27 03:16:31.581]
TX:AT+CIPMODE=1
[2024-01-27 03:16:31.586]
RX:
OK
[2024-01-27 03:16:46.613]
TX:AT+CIPSEND
[2024-01-27 03:16:46.617]
RX:
OK
>
[2024-01-27 03:16:54.120]
TX:GET http://api.yytianqi.com/observe? city=CH210101&key=*********
[2024-01-27 03:16:54.214]
RX:{"code":1,"msg":"Sucess","counts":19997,"data":{"cityId":"CH210101","cityName":"\u676d\u5dde","lastUpdate":"2024-01-27 15:14:25","tq":"\u6674","numtq":"00","qw":"7","numfl":"0","fl":"\u5fae\u98ce","fx":"\u4e1c\u98ce","numfx":"2","sd":"38"}}
[2024-01-27 03:17:18.005]
TX:++
[2024-01-27 03:17:18.092]
RX:<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx/1.4.7</center>
</body>
</html>
[2024-01-27 03:17:46.318]
TX:+++ //不要回车哈
[2024-01-27 03:17:46.386]
RX:<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx/1.4.7</center>
</body>
</html>
[2024-01-27 03:18:04.796]
TX:+++ //退出透传
[2024-01-27 03:18:17.486]
TX:+++
[2024-01-27 03:18:24.309]
TX:AT //退出透传
[2024-01-27 03:18:24.315]
RX:
OK
[2024-01-27 03:18:46.563]
RX:CLOSED
AT+CIPCLOSE //断开连接
2.一点建议哈
其实WiFi模块用arduino ide开发好像更方便。arduino开发后就不能使用AT开发了,重新烧写固件可以继续开发。
想要真正的学点东西,有时间直接lua开发固件,lua是基于c的脚本语言,使用场景我碰到有一些触摸屏,WiFi,4G,DTU,RTU,游戏渲染引擎,游戏更新等方面。
3.硬件接线直接接,接个电源,再接个串口线就可以。
4.如果测试电脑上的tcp_server工具每次都连接不上,是因为防火墙不允许,直接在防火墙-》允许应用通过防火墙,找到该工具,打勾使能就好。
5.测试一下wifi模块的丢包率:
大概在3%左右,不容乐观。