当前位置:网站首页>基于Arduino和ESP8266的连接手机热点实验(成功)
基于Arduino和ESP8266的连接手机热点实验(成功)
2022-07-02 09:42:00 【每天默默学习】
一、实验介绍
上篇博客介绍了ESP8266的Arduino环境搭建,代码成功下载,说明环境搭建好了,ESP8266上面的灯可以根据代码修改参数闪烁
这篇blog介绍第2个实验:我们通过ESP8266连接手机热点
1、在电脑端串口显示连接状态和ESP的IP
2、手机上打开热点界面可以查看热点连接的设备,显示出ESP的连接状态(这个和程序无关,只是自己用来查看连接状态用)
使用的硬件:
1、Arduino开发板
2、ESP8266开发板
3、数据线
基于ESP8266的Arduino开发环境这里可以查看我的上一篇blog
二、实验过程遇到的常见问题
我遇到的错误是,本次实验想把ESP连线到Arduino,然后通过Arduino把程序下载到开发板
后来发觉好像实现不了,至少目前实现不了
我现在采用的办法是:
1、ESP8266通过数据线连接到电脑,端口COM7
2、Arduino通过数据线连接到电脑,端口COM6
3、Arduino IDE打开代码(后面分享),选择好开发板选项,选择COM7(ESP8266开发板端口,而不是Arduino端口)
4、一直按住ESP98266的FLASH按键,按一下RST,开发板蓝灯亮一下,此过程一直按住FLASH,然后点击下载代码,直到百分比走到100%,完全停下来后,松开FLASH,此时程序下载成功
5、打开手机热点、打开串口,会显示连接状态和ESP的IP,手机热点设置里面也可以查看ESP的连接状态
我现在程序的下载方法是,把ESP和Arduino分别用数据线连接电脑,然后下载程序,而不是通常的把ESP当成传感器模块,连线在Arduino上后,连接Arduino的串口,然后下载代码
三、代码
先分享代码:
// 测试esp8266连接WiFi
#include <ESP8266WiFi.h>
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
WiFi.begin("wyf", "1899*******"); //这里设置成自己的热点或者WIFI的名称和密码
Serial.println();
Serial.print("Connecting");
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println();
Serial.print("Connected, IP address: ");
Serial.println(WiFi.localIP());
}
void loop() {
}
参考:
四、实验结果
现在给大家介绍一下我的实验结果,通过视频来给大家分享
1、因为我重启了ESP8266模块,测试连接状态,按了RST按键
2、电脑Arduino IDE串口显示,多次打印连接状态和ESP的IP:192.168.15.227,串口用ESP串口
3、手机端显示连接,断开,又重新连接上,显示ESP的ID:ESP0D6F56
ESP8266连接手机热点实验
五、目前实验瓶颈
1、现在是两块开发板分别连接下载程序
2、本实验只用到了连接,并没有涉及数据传输,所以,ESP只要供电就实现了WIFI的连接,并没有利用Arduino进行数据处理
把ESP开发板断开数据线,通过杜邦线连接Arduino
ESP Arduino
3v 3.3v
G 接地
EN (本实验未涉及)
TX (本实验未涉及)
RX (本实验未涉及)
或者把Arduino断电,只通电ESP开发板,WIFI依然可以连接
目前实验结果,如果通过杜邦线连接ESP和Arduino,打开Arduino IDE的串口,串口数据并不显示ESP的连接状态,处于空白没有数据的状态,而WIFI只要ESP通电就可以连接上手机热点
其中尝试
ESP Arduino
3v 3.3v
G 接地
EN (本实验未涉及)连接3,3V或者断开
TX (本实验未涉及)连0RX或者1TX
RX (本实验未涉及)连1TX或者0RX
均会发现串口并没有具体的连接状态
所以,准备后续实验继续了解ESP和Arduino的连接方式和运行机制
六、后续实验设想
后续会继续就Arduino的ESP8266做一系列实验
1、利用ESP通过网络传输数据和保存数据,可能会用到云平台
2、通过WIFI实现远程通讯
七、总结
OK,实验做完,记录自己的实验内容,分享出来,希望对你有所帮助,让我们一同快乐的学习和分享,感谢你的浏览。
边栏推荐
- Bedtools tutorial
- Three transparent LED displays that were "crowded" in 2022
- 时间格式化显示
- XSS labs master shooting range environment construction and 1-6 problem solving ideas
- 文件操作(详解!)
- ESP32 Arduino 引入LVGL 碰到的一些问题
- What week is a date obtained by QT
- The selected cells in Excel form have the selection effect of cross shading
- [visual studio 2019] create and import cmake project
- K-Means Clustering Visualization in R: Step By Step Guide
猜你喜欢
Small guide for rapid formation of manipulator (VII): description method of position and posture of manipulator
How to Easily Create Barplots with Error Bars in R
HOW TO CREATE AN INTERACTIVE CORRELATION MATRIX HEATMAP IN R
Dynamic memory (advanced 4)
[visual studio 2019] create and import cmake project
H5,为页面添加遮罩层,实现类似于点击右上角在浏览器中打开
6. Introduce you to LED soft film screen. LED soft film screen size | price | installation | application
How to Add P-Values onto Horizontal GGPLOTS
Esp32 audio frame esp-adf add key peripheral process code tracking
How to Visualize Missing Data in R using a Heatmap
随机推荐
PgSQL string is converted to array and associated with other tables, which are displayed in the original order after matching and splicing
【2022 ACTF-wp】
Writing contract test cases based on hardhat
Precautions for scalable contract solution based on openzeppelin
2022年遭“挤爆”的三款透明LED显示屏
Homer forecast motif
YYGH-BUG-05
YYGH-BUG-04
Seriation in R: How to Optimally Order Objects in a Data Matrice
Visualization of chip SEQ data by deeptools
From scratch, develop a web office suite (3): mouse events
基于Hardhat和Openzeppelin开发可升级合约(一)
php 二维、多维 数组打乱顺序,PHP_php打乱数组二维数组多维数组的简单实例,php中的shuffle函数只能打乱一维
自然语言处理系列(一)——RNN基础
Dynamic debugging of multi file program x32dbg
Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer
B high and beautiful code snippet sharing image generation
GGPLOT: HOW TO DISPLAY THE LAST VALUE OF EACH LINE AS LABEL
The selected cells in Excel form have the selection effect of cross shading
R HISTOGRAM EXAMPLE QUICK REFERENCE