latency when trying to read temperature
Posted: Sat Jan 01, 2022 8:21 am
I am trying to use the PhidgetTemperatureSensor 4-Input, which directly talks to my computer with USB. I manage to read the temperatures but have a strong latency (5-6s) from the time the temperature changes to the time the computer reads this temperature change. This means that if I put my fingers on the termocouple, I have to wait 5 seconds for the computer to tell me the termocouple has become hotter.
This is the code I use to get the data:
I think this is a problem with the buffer of my phidget. In fact if I open and close the phidget each time I want to get a temperature value, I get no latency.
Thanks in advance for the help !
This is the code I use to get the data:
Code: Select all
from Phidget22.Phidget import *
from Phidget22.Devices.TemperatureSensor import *
from time import *
y1=[]
y2=[]
y3=[]
def init_board():
ch = TemperatureSensor()
ch.setChannel(4)
ch.openWaitForAttachment(1000)
ch2 = TemperatureSensor()
ch2.setChannel(0)
ch2.openWaitForAttachment(1000)
ch3 = TemperatureSensor()
ch3.setChannel(1)
ch3.openWaitForAttachment(1000)
return ch, ch2, ch3
(ch, ch2, ch3)=init_board()
try :
while True :
temperature1 = ch.getTemperature()
temperature2= ch2.getTemperature()
temperature3= ch3.getTemperature()
print(temperature1, temperature2, temperature3)
sleep(1)
except(KeyboardInterrupt):
ch.close()
ch2.close()
ch3.close()
Thanks in advance for the help !