Hi there,
Is it possible to run, at the same time, on the same PC, a VINT Hub Phidget (HUB0000_0) with sensors + a PhidgetAnalog 4-Output (1002_0B) ?
If it's possible How can I adress each one?
Thanks for your answer.
Code: Select all
from Phidget22.Phidget import *
from Phidget22.Devices.DistanceSensor import *
from Phidget22.Devices.VoltageOutput import *
from Phidget22.Devices.DigitalOutput import *
import time
def onDistanceChange(self, distance):
print("Distance: " + str(distance))
def main():
sensor0 = DistanceSensor()
sensor1 = DistanceSensor()
sensor2 = DistanceSensor()
voltageOut0 = VoltageOutput()
voltageOut1 = VoltageOutput()
led0 = DigitalOutput()
sensor0.setHubPort(0)
sensor1.setHubPort(1)
sensor2.setHubPort(2)
voltageOut0.setChannel(0)
voltageOut1.setChannel(1)
led0.setHubPort(3)
led0.setIsHubPortDevice(True)
sensor0.setOnDistanceChangeHandler(onDistanceChange)
sensor1.setOnDistanceChangeHandler(onDistanceChange)
sensor2.setOnDistanceChangeHandler(onDistanceChange)
sensor0.openWaitForAttachment(5000)
sensor1.openWaitForAttachment(5000)
sensor2.openWaitForAttachment(5000)
voltageOut0.openWaitForAttachment(5000)
voltageOut1.openWaitForAttachment(5000)
led0.openWaitForAttachment(5000)
try:
input("Press Enter to Stop\n")
except (Exception, KeyboardInterrupt):
pass
sensor0.close()
sensor1.close()
sensor2.close()
voltageOut0.close()
voltageOut1.close()
led0.close()
main()
Users browsing this forum: No registered users and 0 guests