Última atividade 1751712459

mesh_ping.py Bruto
1import sys
2import time
3
4import meshtastic
5import meshtastic.tcp_interface
6
7interval = 10
8if len(sys.argv) > 1:
9 interval = int(sys.argv[1])
10
11while True:
12 try:
13 with meshtastic.tcp_interface.TCPInterface("meshtastic.local") as iface:
14 if iface != None:
15 print("connected to tcp")
16
17 for i in range(10):
18 fmt_time = time.strftime("%H:%M:%S", time.localtime())
19 iface.sendText(f"ping {fmt_time}", wantAck=True, channelIndex=1)
20 print("sent", fmt_time)
21 time.sleep(interval)
22 except KeyboardInterrupt:
23 print("bye")
24 exit(1)
25 except:
26 print("AAA!")
27