import time
import pyvisa
import DMM
TestStep=1500
rm = pyvisa.ResourceManager()
# 打印设备列表
print(rm.list_resources())
THD2015=rm.open_resource('GPIB0::4::INSTR')
FLUKE=rm.open_resource('GPIB0::6::INSTR')
print(FLUKE.query("*IDN?"))
with open("DMM.txt", "a") as file:
while TestStep>=0:
time.sleep(0.5)
Voltage=DMM.ReadVolatge(FLUKE)
temp=DMM.Read(THD2015)
#电压和温度
file.write(" Voltage:")
file.write(str(Voltage))
file.write(" temp:")
file.write(str(temp))
#手动回车
file.write("time:"+time.strftime("%H:%M:%S")+"\n")
TestStep-=1
print("temp:"+temp)
print("Voltage:" + Voltage)
time.sleep(0.1)
file.close()
客户要我们帮忙测温飘,弄了个小工具