HIN1000_0 Capacitive Touch - enabling all buttons

Supporting 2.7 and 3.2+
Post Reply
GIS_Is_Me
Fresh meat
Posts: 3
Joined: Mon Jan 08, 2018 2:14 pm
Contact:

HIN1000_0 Capacitive Touch - enabling all buttons

Post 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().
User avatar
mparadis
Site Admin
Posts: 660
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: HIN1000_0 Capacitive Touch - enabling all buttons

Post 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.
GIS_Is_Me
Fresh meat
Posts: 3
Joined: Mon Jan 08, 2018 2:14 pm
Contact:

Re: HIN1000_0 Capacitive Touch - enabling all buttons

Post by GIS_Is_Me »

Thanks for this. That got me on my way. Next up, trying to wire this up with wxPython.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 0 guests