What I want is to read the voltage ratio with a the minimum data interval, which is 20 ms.
I am trying to call the handler when the VoltageRatioChange event occurs, and I am using setDataInterval(dataInterval) to adjust that the VoltageRatioChange event happen every 20 ms. But it does not work, I tried with many values for dataInterval but it always report values every 250 ms, which is the default value.
How can I fix this and report values every 20 ms changing the DataInterval?
My main code is:
Code: Select all
def main(): #función principal
voltageRatioInput0 = VoltageRatioInput() #Se abre el primer canal
voltageRatioInput1 = VoltageRatioInput() #Se abre el segundo canal
voltageRatioInput0.setHubPort(0) #Se define el puerto al que se conectan ambos canales antes de definir el canal
voltageRatioInput0.setChannel(0) #Se asigna el primer canal al canal 0
voltageRatioInput1.setHubPort(0)
voltageRatioInput1.setChannel(1) #Se asigna el segundo canal al canal 1
voltageRatioInput0.setOnVoltageRatioChangeHandler(onVoltageRatioChange0) #se ejecuta el handler cada vez que cambia la lectura del voltaje de salida
voltageRatioInput1.setOnVoltageRatioChangeHandler(onVoltageRatioChange1)
voltageRatioInput0.openWaitForAttachment(5000) #Abre los dos canales y espera a que se acoplen correctamente
voltageRatioInput1.openWaitForAttachment(5000)
voltageRatioInput0.setDataInterval(data_interval) #se especifica que el canal reporte un nuevo cambio en el voltaje cada data_interval ms
voltageRatioInput1.setDataInterval(data_interval)
voltageRatioInput0.setBridgeGain(BridgeGain.BRIDGE_GAIN_128)
voltageRatioInput1.setBridgeGain(BridgeGain.BRIDGE_GAIN_128)