Supporting Browser-based Javascript and Node.js
alistair.monaghan
Phidgetsian
Posts: 11 Joined: Tue Mar 05, 2019 3:36 am
Post
by 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
Engineering
Posts: 184 Joined: Mon Nov 13, 2017 10:20 am
Post
by 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: 11 Joined: Tue Mar 05, 2019 3:36 am
Post
by alistair.monaghan » Wed Jul 17, 2019 9:35 am
Of course! i was so close, many thanks.
alistair.monaghan
Phidgetsian
Posts: 11 Joined: Tue Mar 05, 2019 3:36 am
Post
by 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?
mparadis
Site Admin
Posts: 679 Joined: Fri Oct 28, 2011 12:17 pm
Post
by 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.