web-monitor/TablePI.py
2025-06-25 20:42:39 -04:00

16 lines
407 B
Python

# client.py on Pi
from networktables import NetworkTables
import time
import psutil
NetworkTables.initialize(server='192.168.1.76') # Laptop IP here
table = NetworkTables.getTable("PiStatus")
while True:
cpu = psutil.cpu_percent()
temp = 52.5 # Example temperature
table.putNumber("CPU Usage", cpu)
table.putNumber("Temperature", temp)
print("Sent data to laptop")
time.sleep(1)