Page 1 of 1

Can't setChannel properly

Posted: Tue Jun 05, 2018 2:34 pm
by Kyle
I want to use Phidgets interface kit 1019 to read data from multiple analog inputs. However, I can read only from the default channel which is channel 0. below is my code as an example. I'm using Python. I printed out the ch1 before and after setChannel(1), but all of them gave me 0. Shouldn't I got 1 after setting channel to 1?

Hope anyone can help me address this problem.
BTW, I followed the steps here:
https://www.phidgets.com/docs/Phidget_P ... ing_Basics

ch1.openWaitForAttachment(5000)
ch1.setOnAttachHandler(onAttachHandler)
ch1.setDeviceSerialNumber(483362)
rospy.loginfo(ch1.getChannel())
ch1.setChannel(1)
rospy.loginfo(ch1.getChannel())
ch1.open()

Re: Can't setChannel properly

Posted: Tue Jun 05, 2018 3:11 pm
by Patrick
Make sure you set the channel and serial number before calling open. Also, you are calling open twice - only call it once, after setting up serial, handlers, etc..

-Patrick

Re: Can't setChannel properly

Posted: Tue Jun 05, 2018 3:18 pm
by Kyle
Thank you Patrick, I didn't realize openWaitForAttachment also open the channel. It worked! Thanks for your quick reply again!