当前位置:网站首页>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
边栏推荐
- Airsim radar camera fusion to generate color point cloud
- [no title] free test questions for constructor municipal direction general foundation (constructor) and theoretical test for constructor municipal direction general foundation (constructor) in 2022
- Transaction method call @transactional
- String coordinates of number to excel
- [question brushing] character statistics [0]
- MATLAB小技巧(16)矩阵特征向量特征值求解一致性验证--层次分析
- Intelligent constant pressure irrigation system
- Utiliser Beef pour détourner le navigateur utilisateur
- vscode自定义各个区域的颜色
- 栈实现计算器
猜你喜欢
随机推荐
[staff] high and low octave mark (the notes in the high octave mark | mark range are increased by one octave as a whole | low octave mark | mark range are decreased by one octave as a whole)
2022.2.15
vscode自定义各个区域的颜色
[question brushing] character statistics [0]
【无标题】
Provincial election + noi part I dynamic planning DP
Gateway-88
栈实现计算器
Yolov5 advanced six target tracking environment construction
使用beef劫持用戶瀏覽器
深度学习训练样本扩增同时修改标签名称
【C】 Summary of wrong questions in winter vacation
XX attack - reflective XSS attack hijacking user browser
Leetcode t34: find the first and last positions of elements in a sorted array
数字转excel的字符串坐标
Connect timed out of database connection
leetcode T31:下一排列
Leetcode t31: prochain arrangement
Koltin35, headline Android interview algorithm
2022 ordinary scaffolder (special type of construction work) examination question bank and the latest analysis of ordinary scaffolder (special type of construction work)








