Without a delay I get a "Phidget Exception 51: Unknown or Invalid Value" error.
It does the same under both Linux and Windows. I have also tried it on both a 1018 Interface and a new VINT Hub with the same result.
No real surprise, but I get the same exact exception error if I use getSensorValue without first doing a setSensorType.
I'm wondering if this is normal? Also seems a little odd the device has to be attached before doing a setSensorType.
In any case, I do have my home heating system program converted over to the Phidget22 API and all is working ok.
Here's quick test.py that demonstrates the getSensorType issue by commenting out sleep(.5)
Code: Select all
from time import sleep
from Phidget22.Phidget import *
from Phidget22.Devices.VoltageRatioInput import *
x = VoltageRatioInput()
x.setDeviceSerialNumber(495394)
x.setIsHubPortDevice(1)
x.setHubPort(2)
x.openWaitForAttachment(5000)
x.setSensorType(0x2be8)
sleep(.5)
try:
print x.getSensorValue()
except PhidgetException as e:
print("Phidget Exception %i: %s" % (e.code, e.details))
print("Press Enter to Exit...\n")
readin = sys.stdin.read(1)
exit(1)
x.close()