HIN1000_0 Capacitive Touch - enabling all buttons

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

HIN1000_0 Capacitive Touch - enabling all buttons

Postby GIS_Is_Me » Tue Jan 16, 2018 4:10 pm

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: 531
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: HIN1000_0 Capacitive Touch - enabling all buttons

Postby mparadis » Wed Jan 17, 2018 10:52 am

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

Postby GIS_Is_Me » Mon Jan 22, 2018 3:30 pm

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


Return to “Python”

Who is online

Users browsing this forum: No registered users and 1 guest