Arduino WiFi 通信
我们 Arduino WiFi入门,一般使用的 Wifi 模块芯片是 ESP8266。现在像我这样天天无线上网不知道 wifi 的人就已经OUT了,赶紧饿补一下:
ESP8266 在搭载应用并作为设备中唯一的应用处理器时,能够直接从外接闪存中启动。内置的高速缓冲存储器有利于提升系统性能,并减少内存需求。
另外一种情况是,无线上接入承担 Wi-Fi 适配器的任务时,可以将其添加到任何基于微控制器的设计中,连接简单易行,只需通过 SPI/SDIO 接口或中央处理器 AHB 桥接即可。
ESP8266 强大的片上处理和存储能力,使其可通过 GPIO 口集成传感器及其他应用的特定设备,实现了最低前期的开发和运行中最少地占用系统资源。ESP8266 高度片内集成,包括天线开关 balun、电源管理转换器,因此仅需极少的外部电路,且包括前端模块在内的整个解决房案在设计时将所占 PCB 空间降到最低。
装有 ESP8266 的系统表现出来的领先特征有:节能 VoIP 在睡眠/唤醒模式之间的快速切换、配合低功率操作的自适应无线电偏置、前端信号的处理功能、故障排除和无线电系统共存特性为消除蜂窝 /蓝牙/DDR/LVDS/LCD干扰。
更多信息请看附件(ESP8266-用户手册-V0.3.pdf)

然后,开始接线


一接上 3.3V 电源,立马感到模块发烫,散热不好处理啊。
烧录 Arduino 程序,测试一下

当时没有保存测试图片,这里就不发了。
本来想拿点时间认认真真写一下的,后来当然有事(在科锐来学习当然不是闹着玩的,作业超多的哦。没有辛勤的付出,那来的那个什么什么。)

又一大牛浮出水面,大家认出来了么?他就是

想了解,大牛们都在干什么吗?请点击如下链接
http://bbs.pediy.com/showthread.php?t=51839
后来,我有空准备再来做的时候,发现这个还是点麻烦(把我烫了几下是一方面,另一方面是我不想搭单片机环境,不想再买电烙铁等来焊上),就在网上重新买了一个块,这样用起来感觉还是方便一些,关键是这板子也不怎么贵。

板子的接口和我手机的一样,又省下一根数据线了。

如果电脑上出现COM端口说明驱动是安装成功了。否则需要安装驱动,这里就不多说了。这个使用起来也是很方便的,请看下图吧。

当然官网下载的Arduino IDE是不会这样的,如果你购买了,卖家一般会告诉你怎么做的,如果没有那就自己网上搜搜,一定会找到的。
然后先随便找个代码试了一下发现成功

当然,这只是简单的开始。真正的无线wifi才准备开始
需要说明一点的是:程序编译和上传过程有点慢

测试程序源码:


上传成功以后就会看到 ESPap 无线热点,是不是感觉很方便的样子。
需要注意一点的是,密码是:thereisnospoon

如果连接上了,打不开网页,重启一下就好了。

当然网页内容是可以更改的,如果你想换成别的只要把上面源码中的代码稍微修改一下就好了。在这里我就不多做测试了。
void handleRoot() {
server.send(200, "text/html", "
You are connected
");//把这里的内容修改一下就好}
我们再来个Get网页的例子吧
测试程序源码:




上传程序后,如果只是不停打印‘.’(十六进制2E)的话,没有像下图中类似情况的话,重启一下(是按一下开发板的按钮,不是把电脑重启)。
Arduino自带的串口监视工具功能还要有所欠缺,收到的内容看起来变成了乱码,没办法看。

换了个工具试一下,发现还是十六进制好看一点。当然再带个十六进制编辑器就更好了。
数据部分应该是这些:
73 24 00 6C 9C 9F 3C 00 84 6C E0 7C 03 0C 04 0C 84 04 6C E4 0C 23 7C 8F 83 03 EC 13 9B 73 9B 23 84 04 63 84 FB 27 6F DF 64 6F 27 9C E2 E4 04 63 1C 70 C4 C7 64 73 64 72 64 38 FB 67 E0 10 03 0C 04 82 04 24 0C 84 9C 04 04 0C 62 0C 27 E3 7C 03 64 8C 84 8F C7 62 8C F3 6F 67 E7 00 6C 84 8F 6C 60 03 90 1B 13 6F 67 04 6C 20 03 0F 03 6E 7B 87 93 DB 67 04 0C 83 C4 6C 60 03 07 73 DB 93 6E 0C 04 C3 8C 64 60 03 FC 83 6F DC 03 0D 0A 0D 0A 43 6F 6E 6E 65 63 74 69 6E 67 20 74 6F 20 79 6F 75 72 2D 73 73 69 64 0D 0A
现在只记得0D 0A好像是回车换行吧,其他的具体是什么,我就不太清楚,也不想关心了。什么时候需要的这方面的,再做实验。
程序开发是逆向的基础。不知道,你同不同意这个观点。
再来一个wifi扫描的吧,先看一下效果图吧

测试程序源码:


--end--
声明:本文章由网友投稿作为教育分享用途,如有侵权原作者可通过邮件及时和我们联系删除:freemanzk@qq.com