Files
2026-05-22 10:51:16 -06:00

30 lines
521 B
Python

import struct
from websocket import create_connection
ws = create_connection("ws://10.42.0.100:81")
print("Conectado")
i = 0
try:
while True:
data = ws.recv()
i += 1
if isinstance(data, bytes):
# Convertir bytes -> uint16_t
samples = struct.unpack(f"<{len(data) // 2}H", data)
print("ADC:", samples)
else:
print("TXT:", data)
print(f"DEBUG {i}")
except KeyboardInterrupt:
print("Cerrando conexión")
ws.close()