代码拉取完成,页面将自动刷新
使用 ESP8266 控制超声波测距模块和继电器模块 自动/手动/远程 控制小家电
NodeMCU
HC-SR04 模块
,驱动电压5V
低电平触发
,驱动电压5V
在上传代码文件到NodeMCU的时候,务必排除以下文件/文件夹,以节省存储空间
.gitignore
README.md
/images
/web/images
NodeMCU模块
上电客户端
连接客户端
连接Wifi热点,热点名称Walkline
,密码12345678
客户端
连接成功后蓝色Led灯会停止闪烁http://192.168.4.1:8266
,网页内容如图所示如果使用串口工具连接
NodeMCU模块
,会显示如下调试信息
Wifi access point intialized:
ssid: Walkline
password: 12345678
Server started and listening on ('0.0.0.0', 8266)
client connected from ('192.168.4.2', 47566)
- client request: GET / HTTP/1.1
- request file: /
-- file name: /web/index.html
-- file size: 4697
- send response header
- send response file
- file send ok
client connection closed manually
client connected from ('192.168.4.2', 47569)
- client request: GET /js/main.js HTTP/1.1
- request file: /js/main.js
-- file name: /web/js/main.js
-- file size: 18927
- send response header
- send response file
- file send ok
client connection closed manually
client connected from ('192.168.4.2', 47572)
- client request: GET /?query_command=get_status HTTP/1.1
- send js response header
- send js response data
- js response send ok
client connection closed manually
控制NodeMCU模块
主要是使用它控制超声波测距模块和继电器模块,实现远程 / 自动
控制继电器模块的目的
直接点击页面中的Turn On / Turn Off
按钮,就可以实现远程控制继电器
点击页面中的Auto
按钮,直到Manual
按钮变为蓝色,就可以实现自动控制继电器
直接使用面包板上的按钮,就可以实现手动控制继电器
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。