class Tinkerforge::BrickletMotorizedLinearPoti

Public Instance Methods

hold(position=nil)
Alias for: lock
lock(position=nil) click to toggle source

Locks the position of the potentiometer. If a position is given, moves to that position first.

# File lib/tinderfridge/devices/bricklet_motorized_linear_poti/bricklet_motorized_linear_poti.rb, line 21
def lock(position=nil)
  set_motor_position( position || get_position, get_motor_position[1], true )
end
Also aliased as: hold
move_to(position)
Alias for: position=
position() click to toggle source

Returns the position of the potentiometer (an integer in the range 0..100).

# File lib/tinderfridge/devices/bricklet_motorized_linear_poti/bricklet_motorized_linear_poti.rb, line 6
def position
  get_position
end
position=(position) click to toggle source

Moves the potentiometer to the given position.

If the potentiometer was locked before, it will be locked at the new position. The drive mode (speed) will be the same as the last time the position was set.

# File lib/tinderfridge/devices/bricklet_motorized_linear_poti/bricklet_motorized_linear_poti.rb, line 14
def position=(position)
  set_motor_position( position, *get_motor_position[1,2] )
end
Also aliased as: move_to
release(position=nil) click to toggle source

Releases the potentiometer, so its position can be changed by hand. If a position is given, moves to that position first.

# File lib/tinderfridge/devices/bricklet_motorized_linear_poti/bricklet_motorized_linear_poti.rb, line 28
def release(position=nil)
  set_motor_position( position || get_position, get_motor_position[1], false )
end
state() click to toggle source

Returns the device's state.

Calls superclass method
# File lib/tinderfridge/devices/bricklet_motorized_linear_poti/bricklet_motorized_linear_poti.rb, line 33
def state
  super.merge(
    'position'       => get_position,
    'motor_position' => get_motor_position,
  )
end