try to use a PhidgetBridge 4-Input: getVoltageRatio raise PhidgetException(result)
Posted: Thu Feb 06, 2020 12:29 pm
Hi, I'm trying to read the voltage ratio from a 1046_0B 'PhidgetBridge 4-Input'
https://www.phidgets.com/?tier=3&catid= ... rodid=1027
in Python.
The code example from
https://www.phidgets.com/?tier=3&catid= ... rodid=1027
works fine. The voltage ratio is printed to the console and changes when applying forces to my load cell.
However, I would like to read the voltage directly, instead of relying on a event. The API function for this seems to be getVoltageRatio()
However, I can not run the example from the API docu
https://www.phidgets.com/?view=api&prod ... ang=Python
The error message is
https://www.phidgets.com/?tier=3&catid= ... rodid=1027
in Python.
The code example from
https://www.phidgets.com/?tier=3&catid= ... rodid=1027
works fine. The voltage ratio is printed to the console and changes when applying forces to my load cell.
Code: Select all
from Phidget22.Phidget import *
from Phidget22.Devices.VoltageRatioInput import *
import time
def onVoltageRatioChange(self, voltageRatio):
print("VoltageRatio: " + str(voltageRatio))
def main():
voltageRatioInput0 = VoltageRatioInput()
voltageRatioInput0.setOnVoltageRatioChangeHandler(onVoltageRatioChange)
voltageRatioInput0.openWaitForAttachment(5000)
time.sleep(5)
voltageRatioInput0.close()
main()
However, I can not run the example from the API docu
https://www.phidgets.com/?view=api&prod ... ang=Python
Code: Select all
from Phidget22.Phidget import *
from Phidget22.Devices.VoltageRatioInput import *
ch = VoltageRatioInput()
ch.openWaitForAttachment(1000)
voltageRatio = ch.getVoltageRatio()
print("VoltageRatio: " + str(voltageRatio))
ch.close()
Any help appreciated\Phidget22\Devices\VoltageRatioInput.py", line 306, in getVoltageRatio
raise PhidgetException(result)
line 7, in <module>
voltageRatio = ch.getVoltageRatio()