当前位置:网站首页>Serial port to WiFi module communication
Serial port to WiFi module communication
2022-07-01 08:33:00 【Hardware head teacher】
Serial port to WIFI Module communication
One : The method of using the downloader !( Strongly recommend )
There is a downloader that directly changes the corresponding server domain name 、 Router account , Just the password
1:TCP signal communication
server_addr = "192.168.1.101" -- You can also write the domain name of the server directly
server_port = 8080 -- Port number
ap_ssid = "mywifi" -- Router account
ap_passwd = "abc123" -- Router password
-- To configure USB Working in virtual serial mode , This call print() Function will be printed out in the computer serial terminal
--LIB_UsbConfig("CDC")
-- Enabling system 10 The millisecond timer starts to work
--LIB_10msTimerConfig("ENABLE")
-- Set up Wifi Module occupancy TX0、RX0、D5 Pin ,TCP Client Pattern
-- Router account :mywifi Router password :abc123, The server ip:192.168.1.101 Port number :8080
-- Heartbeat packet interval time 0 second ( Don't use the heartbeat mechanism ).
-- Get... Somewhere in the code WIFI Module unique ID Number
--ID_Str=LIB_GetSysUniID()
LIB_IntWifiTcpConfig(ap_ssid,ap_passwd,server_addr,server_port,0)
-- To configure Uart0 The baud rate of serial port is 115200
LIB_Uart0Config("BAUDRATE_115200")
-- Start the big cycle
while(GC(1) == true)
do
recv_flag,uart_recv_tab = LIB_Uart0Recv()
if recv_flag == 1 then
LIB_IntWifiTcpSend(uart_recv_tab)
end
recv_flag,wifi_recv_tab = LIB_IntWifiTcpRecv()
if recv_flag == 1 then
LIB_Uart0Send(wifi_recv_tab)
end
end
2:UDP signal communication
target_addr = "192.168.1.101" -- You can also write the domain name of the server directly , such as "www.shineblink.com" etc.
target_port = 8080
ap_ssid = "mywifi" -- Router account
ap_passwd = "abc123" -- Router password
-- Set up esp8266 Wifi Module occupancy TX0、RX0、D5 Pin ,UDP Pattern , port 1112
-- Router account :mywifi Router password :abc123,UDP Opposite end to be connected IP:192.168.1.101 Port number :8080
-- Heartbeat packet interval time 0 second ( Don't use the heartbeat mechanism ). If you need to use it, please use it in ApiDoc Refer to the document for LIB_WifiUdpConfig Functional p7 Detailed introduction of parameters
LIB_IntWifiUdpConfig(ap_ssid,ap_passwd,target_addr,target_port,0)
LIB_Uart0Config("BAUDRATE_115200")
-- Start the big cycle
while(GC(1) == true)
do
recv_flag,uart_recv_tab = LIB_Uart0Recv()
if recv_flag == 1 then
LIB_IntWifiUdpSend(uart_recv_tab)
end
recv_flag,wifi_recv_tab = LIB_IntWifiUdpRecv()
if recv_flag == 1 then
LIB_Uart0Send(wifi_recv_tab)
end
end
边栏推荐
- [JS reverse] MD5 encryption parameter cracking
- 机动目标跟踪——当前统计模型(CS模型)扩展卡尔曼滤波/无迹卡尔曼滤波 matlab实现
- Serial port oscilloscope software ns-scope
- 2022.6.30 省赛+蓝桥国赛记录
- Leetcode T40: 组合总和II
- Provincial election + noi part I dynamic planning DP
- 程序员养生宝典
- 使用threejs简单Web3D效果
- [untitled]
- Properties of 15MnNiNbDR low temperature vessel steel, Wugang 15MnNiDR and 15MnNiNbDR steel plates
猜你喜欢

View drawing process analysis

【无标题】

Learn the knowledge you need to know about the communication protocol I2C bus

【Redis】一气呵成,带你了解Redis安装与连接

【C】 Summary of wrong questions in winter vacation

Redis publish subscription

What is 1cr0.5mo (H) material? 1cr0.5mo (H) tensile yield strength

MATLAB小技巧(16)矩阵特征向量特征值求解一致性验证--层次分析

Li Kou 1358 -- number of substrings containing all three characters (double pointer)

使用 setoolkit 伪造站点窃取用户信息
随机推荐
《微机原理》——微处理器内部及外部结构
There are many problems in sewage treatment, and the automatic control system of pump station is solved in this way
2022 Chinese cook (technician) simulation test and Chinese cook (technician) practice test video
2022 examination summary of quality controller civil engineering direction post skills (quality controller) and reexamination examination of quality controller civil engineering direction post skills
Leetcode T39: 组合总和
栈实现计算器
长安链同步节点配置与启动
分享2022上半年我读过的7本书
MATLAB小技巧(16)矩阵特征向量特征值求解一致性验证--层次分析
Airsim radar camera fusion to generate color point cloud
[深度剖析C语言] —— 数据在内存中的存储
Rumtime 1200 upgrade: London upgrade support, pledge function update and more
01 NumPy介绍
谈谈数字化转型的几个关键问题
[untitled]
slice扩容机制分析
毕业论文中word的使用1-代码域标公式
Leetcode T40: 组合总和II
P4 installation bmv2 detailed tutorial
What is the material of 15CrMoR, mechanical properties and chemical analysis of 15CrMoR