- VINT Hub Phidget (HUB0001_0)
- DC Motor Phidget (DCC1000_0)
- Voltage Input Phidget (VCP1000_0)
- 30A Current Sensor Phidget (VCP1100_0)
- Temperature Phidget (TMP1000_0)
I'm running the code below. Even with the temperature sensor portion commented out the voltage input sensor doesn't respond with accurate data when the TMP1000 is plugged in.
Using the Phidget Control Panel, it looks like the getVoltage() command is pulling the voltage reading from the TMP1100 instead of the VCP1000.
Is there a way to force it to look at a specific port on the VINT?
Code: Select all
from Phidget22.Phidget import *
from Phidget22.Devices.DCMotor import *
from Phidget22.Devices.VoltageInput import *
from Phidget22.Devices.CurrentInput import *
from Phidget22.Devices.TemperatureSensor import *
import time
samples = 50
counter = 0
dcMotor0 = DCMotor()
dcMotor0.openWaitForAttachment(5000)
dcMotor0.setTargetVelocity(1)
voltageInput0 = VoltageInput()
voltageInput0.openWaitForAttachment(5000)
currentInput0 = CurrentInput()
currentInput0.openWaitForAttachment(5000)
# temperatureSensor0 = TemperatureSensor()
# temperatureSensor0.openWaitForAttachment(5000)
while counter < samples:
time.sleep(0.1)
print("Sample: " + str(counter) + " Voltage: " + str(voltageInput0.getVoltage()) + " Current: " + str(currentInput0.getCurrent()) + " Temp: " ) #+ str(temperatureSensor0.getTemperature()))
counter += 1
counter = 0
dcMotor0.setTargetVelocity(0)
while counter < samples:
time.sleep(0.1)
print("Sample: " + str(counter + samples) + " Voltage: " + str(voltageInput0.getVoltage()) + " Current: " + str(currentInput0.getCurrent()) + " Temp: " ) #+ str(temperatureSensor0.getTemperature()))
counter += 1
dcMotor0.close()
voltageInput0.close()
currentInput0.close()
# temperatureSensor0.close()