Class: RoboticArm::Base

Inherits:
ComponentMoving show all
Defined in:
lib/robotic-arm.rb

Instance Method Summary collapse

Methods inherited from ComponentMoving

#moving?, #stop

Methods inherited from Component

#active?

Constructor Details

#initialize(robot_arm) ⇒ Base

Returns a new instance of Base.



294
295
296
297
# File 'lib/robotic-arm.rb', line 294

def initialize(robot_arm)
  super(robot_arm)
  @switch = 1     
end

Instance Method Details

#left(seconds = 0) ⇒ Object



299
300
301
302
303
# File 'lib/robotic-arm.rb', line 299

def left(seconds=0)
  return if @active and @moving == :left
  activate(@switch, @val=0x02, seconds)
  @moving = :left  
end

#right(seconds = 0) ⇒ Object



305
306
307
308
309
# File 'lib/robotic-arm.rb', line 305

def right(seconds=0)
  return if @active and @moving == :right
  activate(@switch, @val=0x01, seconds)
  @moving = :right
end