前言
本期文档来介绍一下怎么使用Ai-WB2-32S http_server和http_client demo建立通信;关于http_server demo的修改本期文档也会涉及。
一、器材准备
- 两个Ai-WB2-32S模组
- 两根type-c连接线
- 一台可以使用Linux系统的设备
二、使用http_server demo搭建服务器
第一步 进入目录
cd ~/Ai-Thinker-WB2/applications/protocols/http_server/simple_server/

第二步 编写wifi_execute.c文件

第三步 修改http_server.c文件

第四步 服务器模组上电接入虚拟机
给服务器模组上电后出现如下界面

第五步 编译代码
make -j8


第六步 烧录

make flash p=/dev/ttyUSB0 b=115200


按下模组RST键


第七步 运行服务器
断开模组与虚拟机的连接

打开串口调试助手

按下模组RST键,开始运行服务器

三、使用http_client demo搭建客户端
第一步 进入目录
cd ~/Ai-Thinker-WB2/applications/protocols/http_client_socket/

第二步 编写main.c文件

第三步 修改demo.c文件

第四步 客户端模组上电接入虚拟机

第五步 编译代码
编译过程参考服务器的编译过程
第六步 烧录
烧录过程参考服务器的烧录过程
第七步 运行客户端
断开客户端与虚拟机的连接

再打开一个串口调试助手

按下客户端模组的RST键,开始运行客户端
四、运行结果图


原链接:[https://blog.csdn.net/qq_54193285/article/details/136208336?spm=1001.2014.3001.5501](https://blog.csdn.net/qq_54193285/article/details/136208336?spm=1001.2014.3001.5501) |