Slider phidget being interfered with other phidgets

Supporting 2.7 and 3.2+
Post Reply
ccasend83
Fresh meat
Posts: 1
Joined: Mon Nov 21, 2022 3:15 pm
Contact:

Slider phidget being interfered with other phidgets

Post by ccasend83 »

In my code I have an issue regarding the slider phidget. The slider can read the voltage ratio just fine by itself but when I introduce a thumbstick phidget or any kind of phidget and have .openWaitForAttachment() it breaks the slider phidgets and only outputs lines like this:

VoltageRatio: 6e-05
VoltageRatio: 3e-05
VoltageRatio: 0.0
VoltageRatio: 3e-05

I am using a HUB0000_0 vint hub and quite new to python and phidgets ignore some of the commented Vaxis and Haxis but try to comment on leftMotors.openWaitForAttachment(5000)
rightMotors.openWaitForAttachment(5000)

The code in question:






#Add Phidgets Library
from Phidget22.Phidget import *
from Phidget22.N(if you are reading this remove everything inbetween these brackets)et import *
from Phidget22.Devices.DCMotor import *
from Phidget22.Devices.VoltageRatioInput import *
#Required for sleep statement
import time

def onVoltageRatioChange(self, voltageRatio):
print("VoltageRatio: " + str(voltageRatio))

slider = VoltageRatioInput()

#Create
Net.addServer("", "192.168.100.1", 5661, "", 0)

leftMotors = DCMotor()
rightMotors = DCMotor()
#vAxis = VoltageRatioInput()
#hAxis = VoltageRatioInput()


#Address
leftMotors.setChannel(0)
rightMotors.setChannel(1)
#vAxis.setChannel(0)
#hAxis.setChannel(1)
slider.setHubPort(3)
slider.setIsHubPortDevice(True)

#Open
leftMotors.openWaitForAttachment(5000)
rightMotors.openWaitForAttachment(5000)
#vAxis.openWaitForAttachment(5000)
#hAxis.openWaitForAttachment(5000)
slider.openWaitForAttachment(1000)

slider.setOnVoltageRatioChangeHandler(onVoltageRatioChange)

slider.open()

#Use your Phidgets
while(True):


time.sleep(0.25)
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests