Phidget 1048

Supporting 2.7 and 3.2+
Post Reply
cobrien
Fresh meat
Posts: 1
Joined: Fri Dec 01, 2017 7:28 pm
Contact:

Phidget 1048

Post 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".
User avatar
mparadis
Site Admin
Posts: 959
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: Phidget 1048

Post 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.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 17 guests