当前位置:网站首页>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
边栏推荐
- vscode自定义各个区域的颜色
- 2022 examination summary of quality controller civil engineering direction post skills (quality controller) and reexamination examination of quality controller civil engineering direction post skills
- MATLAB小技巧(23)矩阵分析--模拟退火
- Serial port oscilloscope software ns-scope
- How to use OKR as the leadership framework of marketing department
- 【刷题】字符统计【0】
- Book of quantitative trading - reading notes of the man who conquers the market
- Field agricultural irrigation system
- Learn the knowledge you need to know about the communication protocol I2C bus
- Yolov5 advanced 7 target tracking latest environment setup
猜你喜欢

Agrometeorological environment monitoring system

seaborn clustermap矩阵添加颜色块

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

The data analyst will be ruined without project experience. These 8 project resources will not be taken away

Serial port oscilloscope software ns-scope

《微机原理》——微处理器内部及外部结构

CPU設計實戰-第四章實踐任務一簡單CPU參考設計調試

View drawing process analysis

Audio-AudioRecord create(一)

SPL-安装与基本使用(二)
随机推荐
Properties of 15MnNiNbDR low temperature vessel steel, Wugang 15MnNiDR and 15MnNiNbDR steel plates
Mavros sends a custom topic message to Px4
Manually dig XSS vulnerabilities
Yolov5 advanced six target tracking environment construction
Leetcode T34: 在排序数组中查找元素的第一个和最后一个位置
To prevent "activation" photos from being muddled through, databao "live detection + face recognition" makes face brushing safer
毕业论文中word的使用1-代码域标公式
基于Gazebo的无人机管道检测
Koltin35, headline Android interview algorithm
Provincial election + noi Part III tree problems
Find the nearest n-th power of 2
How to recruit Taobao anchor suitable for your own store
AES简单介绍
empirical study and case study
R语言入门
golang中的正则表达式使用注意事项与技巧
Provincial election + noi Part VI skills and ideas
C basic knowledge review (Part 4 of 4)
Conception et mise en service du processeur - chapitre 4 tâches pratiques
Learn the knowledge you need to know about the communication protocol I2C bus