Method: Phidgets::BLDCMotor#setOnPositionChangeHandler

Defined in:
lib/phidgets/bldc_motor.rb

#setOnPositionChangeHandler(cb_proc = nil, &cb_block) ⇒ Object Also known as: on_position_change

call-seq:

setOnPositionChangeHandler(proc=nil, &block)

Assigns a handler that will be called when the PositionChange event occurs.



22
23
24
25
26
# File 'lib/phidgets/bldc_motor.rb', line 22

def setOnPositionChangeHandler(cb_proc = nil, &cb_block)
  @on_position_change_thread.kill if defined? @on_position_change_thread and @on_position_change_thread.alive?
  callback = cb_proc || cb_block
  @on_position_change_thread = Thread.new {ext_setOnPositionChangeHandler(callback)}
end