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()