Skip to content

Instantly share code, notes, and snippets.

View tiagocoutinho's full-sized avatar

Jose Tiago Macara Coutinho tiagocoutinho

View GitHub Profile
@tiagocoutinho
tiagocoutinho / client.py
Last active September 25, 2024 08:06
read temp periodically
import time
import socket
def temp_stream():
with socket.create_connection(("localhost", 10_123)) as sock:
sockfd = sock.makefile("rwb", buffering=1)
while True:
sockfd.write(b"TEMP?\n")
payload = sockfd.readline()
yield float(payload)