Sha256: a364f6fd3c4128d1217d91653b6c3590b783b5e6f959c1c6d17b047d39f8e74f

Contents?: true

Size: 345 Bytes

Versions: 1

Compression:

Stored size: 345 Bytes

Contents

module Dino
  module Components
    class Servo < BaseComponent
      attr_reader :position

      def initialize(options)
        super(options)

        set_pin_mode(:out)
        self.position = 0
      end

      def position=(new_position)
        @position = new_position % 180
        analog_write(@position)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dino-0.8 lib/dino/components/servo.rb