We try to use a dial encoder as device for receiving zoom data from a camera.
In a small interval (20ms) we need either a position value or a callback function for this.
We modified the encoder sample to reduce the interval setting, but nothing happens.
...
PhidgetEncoder_setDataInterval(ch, 20);
PhidgetEncoder_setPositionChangeTrigger(ch, 20);
If you want the measurement to be updated every 20ms, you will need to set the PositionChangeTrigger to 0.
For encoders, the change trigger prevents the channel from updating until the position changes by the specified amount (20 counts in your sample). A change trigger of 0 will update the position and fire an event every dataInterval (20ms in your case).
but this there a special position in code where to set this?
If i change to 0 after init (prc = Phidget_setHubPort((PhidgetHandle)ch, channelInfo.hubPort))... (PhidgetEncoder_setPositionChangeTrigger(ch, 0)) nothing changes, the interval is stable on 1000ms.
You would need to call it after it is attached. Many properties require the device to be attached before setting them. This can be done either in the AttachHandler or once you know it is attached. If you check the return code on PhidgetEncoder_setPositionChangeTrigger(ch, 0) prior to calling open or before it is attached, you would see EPHIDGET_NOTATTACHED.
You'll want something like (pseudo-code): SetHubPort
SetDeviceSerialNumber
OpenWaitforAttach
SetChangeTrigger
SetDataInterval
or if you have an AttachHandler put SetChangeTrigger
SetDataInterval
inside of it