Touch Wheel Phidget only button 0 working

Supporting Browser-based Javascript and Node.js
alistair.monaghan
Phidgetsian
Posts: 6
Joined: Tue Mar 05, 2019 3:36 am
Contact:

Touch Wheel Phidget only button 0 working

Postby alistair.monaghan » Wed Jul 17, 2019 9:13 am

I've downloaded the Javascript resource for CapacitiveTouch but it only seems to work for the 0 touch button and not the scroll wheel?

There is an option to view the axisField and axisDial so it must be possible - anyone know where I'm going wrong...or have a working example?

jdecoux
Labview Developer
Posts: 84
Joined: Mon Nov 13, 2017 10:20 am
Contact:

Re: Touch Wheel Phidget only button 0 working

Postby jdecoux » Wed Jul 17, 2019 9:28 am

The scroll wheel is on channel 4 for the HIN1001, though the example will connect to channel 0 by default.

If you set the channel to 4 before opening it, the scroll wheel will be attached.

Code: Select all

var ch = new phidget22.CapacitiveTouch();

ch.setChannel(4);

//Set up event handlers and other addressing here

ch.open(5000);

alistair.monaghan
Phidgetsian
Posts: 6
Joined: Tue Mar 05, 2019 3:36 am
Contact:

Re: Touch Wheel Phidget only button 0 working

Postby alistair.monaghan » Wed Jul 17, 2019 9:35 am

Of course! i was so close, many thanks.

alistair.monaghan
Phidgetsian
Posts: 6
Joined: Tue Mar 05, 2019 3:36 am
Contact:

Re: Touch Wheel Phidget only button 0 working

Postby alistair.monaghan » Thu Jul 18, 2019 3:00 am

ok, thanks again, just following on from this...is there a way to stop the axisDial value at 1 and 0? i.e. it doesn't loop?

User avatar
mparadis
Site Admin
Posts: 626
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: Touch Wheel Phidget only button 0 working

Postby mparadis » Thu Jul 18, 2019 8:19 am

You need to handle this special case in your code. In the change handler for the scroll wheel, compare the incoming value with the previous value and ignore it if the change is too large (0.8 or more maybe?). This should cause the scrolling to stop when you hit the seam.


Return to “Javascript”

Who is online

Users browsing this forum: No registered users and 1 guest