Class: RapiroWrapper::Head
- Inherits:
-
ServoMotor
- Object
- ServoMotor
- RapiroWrapper::Head
- Defined in:
- lib/rapiro_wrapper/servo_motor/head.rb
Overview
Head class for RAPIRO
Constant Summary collapse
- NO =
0
- DEFAULT =
90
- MIN =
0
- MAX =
180
Instance Method Summary collapse
-
#initialize(left: nil, right: nil) ⇒ Head
constructor
A new instance of Head.
Methods inherited from ServoMotor
Constructor Details
#initialize(left: nil, right: nil) ⇒ Head
Returns a new instance of Head.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/rapiro_wrapper/servo_motor/head.rb', line 9 def initialize(left: nil, right: nil) fail ArgumentError if left && right if left @value = DEFAULT + left elsif right @value = DEFAULT - right else @value = DEFAULT end fail ArgumentError unless @value.between?(MIN, MAX) end |