Hw dial set acceleration

From Sim Innovations Wiki
Jump to navigation Jump to search


hw_dial_set_acceleration(hw_dial_id, acceleration)

hw_dial_set_acceleration is used to change the acceleration of a rotary encoder.

Return value

This function won't return any value.


# Argument Type Description
1 hw_dial_id id The is the reference to the rotary encoder. You can get this reference from the hw_dial_add function.
2 acceleration Number A multiplier that will make the dial generate extra callbacks when the dial is being rotated faster. The multiplier is the maximum number of callbacks of one dial tick when this dial is being rotated at maximum speed.


function dial_change(direction)
  if direction == 1 then
    print("The dial turned clockwise")
  else if direction == -1 then
    print("The dial turned counterclockwise")

-- Create the rotary encoder
my_dial = hw_dial_add("Heading", dial_change)

-- Change the acceleration
hw_dial_set_acceleration(my_dial, 2.0)