Page 1 of 1

Phidget 1048

Posted: Fri Dec 01, 2017 7:46 pm
by cobrien
I want to change the temperature update rate of the 1048 from its default.
In the example python code "Temperature.py", the line

ch.setOnTemperatureChangeHandler(TemperatureChangeHandler)

is what will print out the temperature read off of the 1048, but only for 10 seconds.

1.) How do I loop it continually?

2.) How do I change the trigger update rate.

I have tried to call

getTemperature(),
setDataInterval(), and
setTemperatureChangeTrigger(),

but all of them cause the Phidget not to be attached and throws the exception "Device Not Attached".

Re: Phidget 1048

Posted: Mon Dec 04, 2017 3:47 pm
by mparadis
setDataInterval is the correct function to use. You should call it in the attach handler (named "VoltageInputAttached" in our sample code). If I remember correctly, there was a fix to python recently so make sure you have the most up-to-date Phidgets libraries.

As for how to make it loop continuously, you can either create an infinite loop with a time.sleep(1) inside of it, or you can wait for user input using

Code: Select all

input()
in python 3, or

Code: Select all

rawinput() 
in python 2.7. This function will allow the program to continue with data events firing until the enter button is pressed.