VCP1001 Error: AttributeError: 'VoltageInput' object has no attribute 'setDataRate'

Supporting 2.7 and 3.2+
Post Reply
pythoncoder2002
Fresh meat
Posts: 2
Joined: Wed Feb 17, 2021 5:59 pm
Contact:

VCP1001 Error: AttributeError: 'VoltageInput' object has no attribute 'setDataRate'

Post by pythoncoder2002 »

Trying to use the setDataRate method (per documentation), on the VCP1001 but getting the following error:

Code: Select all

voltageInput0 = VoltageInput()
voltageInput0.setHubPort(0)
voltageInput0.setOnVoltageChangeHandler(onVoltageChangePort0)
voltageInput0.setOnErrorHandler(onError)

voltageInput0.openWaitForAttachment(1000)
voltageInput0.setVoltageChangeTrigger(0.0)
voltageInput0.setDataRate(1000)

Code: Select all

AttributeError: 'VoltageInput' object has no attribute 'setDataRate'
I'm using python 3.8.10 with libphidget22-1.10.20220530 and python module v 1.6.20201024.

Any suggestions?
User avatar
mparadis
Site Admin
Posts: 660
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: VCP1001 Error: AttributeError: 'VoltageInput' object has no attribute 'setDataRate'

Post by mparadis »

You will need to update your phidget22 python module to a newer version, since DataRate was added more recently than 2020.

That being said, you can just use DataInterval instead, which uses milliseconds between samples instead of samples per second. DataRate was added because we're starting to come out with devices that can provide more than 1 sample per millisecond, and DataInterval is an integer so the reciprocal DataRate was needed. For devices like the VCP1001 that existed before DataRate, the two properties are interchangable (e.g., setting a DataInterval of 40ms is the same as setting a DataRate of 25Hz).
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests