24 lines
634 B
Python
24 lines
634 B
Python
from pc_utils import get_cpu_usage, get_memory_usage, get_cpu_temp
|
|
#import serial
|
|
from time import sleep
|
|
|
|
# connect to microbit
|
|
#ser = serial.Serial('/dev/ttyACM0', 115200, timeout=1)
|
|
#ser.flush()
|
|
print("Connected to microbit.")
|
|
|
|
while True:
|
|
sleep(1)
|
|
cpu_usage = get_cpu_usage()
|
|
memory_usage = get_memory_usage()
|
|
cpu_temp = get_cpu_temp()
|
|
print(f"CPU Usage: {cpu_usage}%")
|
|
print(f"Memory Usage: {memory_usage}%")
|
|
print(f"CPU Temperature: {cpu_temp}°C")
|
|
print('--------')
|
|
|
|
data = [cpu_usage, memory_usage, cpu_temp]
|
|
data_str = ','.join(map(str, data))
|
|
#send_serial_data(data_str, ser)
|
|
|