lib/artoo/drivers/servo.rb in artoo-arduino-1.0.1 vs lib/artoo/drivers/servo.rb in artoo-arduino-1.0.2

- old
+ new

@@ -2,11 +2,11 @@ module Artoo module Drivers # Servo behaviors for Firmata class Servo < Driver - COMMANDS = [:move, :min, :center, :max].freeze + COMMANDS = [:move, :min, :center, :max, :current_angle].freeze attr_reader :current_angle # Create new Servo with angle=0 def initialize(params={}) @@ -28,10 +28,10 @@ # @param [Integer] angle must be between 0-180 def move(angle) raise "Servo angle must be an integer between 0-180" unless (angle.is_a?(Numeric) && angle >= 0 && angle <= 180) @current_angle = angle - connection.set_pin_mode(pin, Firmata::Board::SERVO) + connection.set_pin_mode(pin, Firmata::PinModes::SERVO) connection.analog_write(pin, angle_to_span(angle)) end # Moves to min position def min