Page 1 of 1

HIN1000_0 Capacitive Touch - enabling all buttons

Posted: Tue Jan 16, 2018 4:10 pm
by GIS_Is_Me
Complete Phidget N00b here.
My goal is to get the HIN1000_0 responding to touches on any of it's seven touchpads.

To that end, I've downloaded, walked through and ran the example code

CapacitiveTouch.py.

Thing is, I can't figure out how to get touchValue to correspond to the channel of the touchpad that was touched. This defaults to 0 or can be set via setChannel().

Re: HIN1000_0 Capacitive Touch - enabling all buttons

Posted: Wed Jan 17, 2018 10:52 am
by mparadis
Each CapacitiveTouch object can only be assigned to one button on the HIN1000. You'll need to make multiple objects to use multiple buttons at the same time:

Code: Select all

ch0 = CapacitiveTouch()
ch1 = CapacitiveTouch()

def TouchHandler(e, touchValue):
    print("Channel %d Touch Value: %f" % (e.getChannel(),touchValue))

ch0.setOnTouchHandler(TouchHandler)
ch1.setOnTouchHandler(TouchHandler)

ch0.setChannel(0)
ch1.setChannel(1)

ch0.openWaitForAttachment(5000)
ch1.openWaitForAttachment(5000)

print("Gathering data for 10 seconds...")
time.sleep(10)

ch0.close()
ch1.close()
If you plan on using all 7 channels, it would be cleaner to create an array of CapacitiveTouch objects and use loops to run through all of these steps.

Re: HIN1000_0 Capacitive Touch - enabling all buttons

Posted: Mon Jan 22, 2018 3:30 pm
by GIS_Is_Me
Thanks for this. That got me on my way. Next up, trying to wire this up with wxPython.