forked from ok1cdj/SX1281_QO100_TX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UDP_Test_script.py
41 lines (31 loc) · 1009 Bytes
/
UDP_Test_script.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#
# Simple python program which emulates basic cwdaemon functions
# - set wpm
# - send message
#
# Use it to test the developed firmware of ESP32 or to test/debug your connectivity to ESP32 WiFi
#
# 2021, OM2JU, Jan Uhrin
#
#
#
import socket
from time import sleep
UDP_IP = "192.168.1.17"
UDP_PORT = 6789
MSG_TX_1 = "UDP Test"
MSG_SPEED_15 = chr(27) + '2' + "15"
MSG_SPEED_30 = chr(27) + '2' + "30"
print("UDP target IP:", UDP_IP)
print("UDP target port:", UDP_PORT)
print("message:", MSG_TX_1)
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # UDP
print("Sending with 15wpm...")
sock.sendto(bytes(MSG_SPEED_15, "ascii"), (UDP_IP, UDP_PORT))
sleep(0.1)
sock.sendto(bytes(MSG_TX_1, "ascii"), (UDP_IP, UDP_PORT))
sleep(5) # This delay shold allow to transmit complete message with 15wpm
print("Sending with 30wpm...")
sock.sendto(bytes(MSG_SPEED_30, "ascii"), (UDP_IP, UDP_PORT))
sleep(0.3)
sock.sendto(bytes(MSG_TX_1, "ascii"), (UDP_IP, UDP_PORT))