Method: Phidgets::BLDCMotor#setOnVelocityUpdateHandler

Defined in:
lib/phidgets/bldc_motor.rb

#setOnVelocityUpdateHandler(cb_proc = nil, &cb_block) ⇒ Object Also known as: on_velocity_update

call-seq:

setOnVelocityUpdateHandler(proc=nil, &block)

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



33
34
35
36
37
# File 'lib/phidgets/bldc_motor.rb', line 33

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