Ejemplo n.º 1
0
root = Tk()
root.title("Info Display Serial Server")
S = Scrollbar(root)
S.pack(side=RIGHT, fill=Y)
T = Text(root, height=50, width=100)
S.config(command=T.yview)
T.pack()
T.config(yscrollcommand=S.set)

#Configure Open Hardware Lib
c = Computer()
c.CPUEnabled = True  # get the Info about CPU
c.GPUEnabled = True  # get the Info about GPU
c.MainboardEnabled = True
c.FanControllerEnabled = True
c.HDDEnabled = True
c.RAMEnabled = True
c.Open()

#Message Send Delay, we could sent multiple commands with same message but we are lazy and only sent one command with every message, this is the time between the messages
#crappy com structure but works
MsgDelay = 0.15

#Settings for Serial Interface
ser = serial.Serial()
ser.baudrate = 115200
ser.port = 'COM3'


def TK_print(out):
    T.insert(END, out)
Ejemplo n.º 2
0
    '/intelcpu/0/temperature/0', '/intelcpu/0/temperature/1',
    '/intelcpu/0/temperature/2', '/intelcpu/0/temperature/3'
]

hardware = ['/intelcpu/0']

__sensors = []
__hw = []

comp = Computer()

comp.MainboardEnabled = False
comp.RAMEnabled = False
comp.CPUEnabled = True
comp.GPUEnabled = False
comp.HDDEnabled = False
comp.Open()

for hw in comp.Hardware:
    print(hw.Identifier, hardware)
    if str(hw.Identifier) in hardware:
        __hw.append(hw)

        hw.Update()
        for sensor in hw.Sensors:
            if str(sensor.Identifier) in sensors:
                __sensors.append(sensor)

while True:

    try:
Ejemplo n.º 3
0
import clr
import time
clr.AddReference("C:/Users/63450/Desktop/毕业实习/day1/OpenHardwareMonitorLib.dll"
                 )  #加载C#的库这个库网上可以下载
from OpenHardwareMonitor.Hardware import Computer
computer_tmp = Computer()  #实例这这个类

computer_tmp.CPUEnabled = True
computer_tmp.GPUEnabled = True  #获取GPU温度时用
computer_tmp.HDDEnabled = True
computer_tmp.RAMEnabled = True  #获取内存温度时用

computer_tmp.Open()

print(computer_tmp.Hardware[0].Identifier)
print(computer_tmp.Hardware[0].Sensors)
while True:
    for a in range(0, len(computer_tmp.Hardware[0].Sensors)):
        #print computer_tmp.Hardware[0].Sensors[a].Identifier
        if str(computer_tmp.Hardware[0].Sensors[a].Identifier
               ) == "/intelcpu/0/temperature/4":
            print(computer_tmp.Hardware[0].Sensors[a].Value)
            computer_tmp.Hardware[0].Update()
    time.sleep(1)