Sha256: 04f2d31e6af6c51fd03dea7bf5c72dffd1d1582c4850ee0793f87ee920bfc365

Contents?: true

Size: 651 Bytes

Versions: 2

Compression:

Stored size: 651 Bytes

Contents

require 'artoo'

# Circuit and schematic here: http://arduino.cc/en/Tutorial/Sweep

connection :firmata, :adaptor => :firmata, :port => '/dev/ttyACM0' #linux
#connection :firmata, :adaptor => :firmata, :port => '127.0.0.1:8023'
device :board, :driver => :device_info
device :servo, :driver => :servo, :pin => 3 # pin must be a PWM pin

work do
  puts "Firmware name: #{board.firmware_name}"
  puts "Firmata version: #{board.version}"

  servo.move(0) # reset the position of the sweep (same as servo.min)

  every(2) do
    case servo.current_angle
    when 0 then servo.center
    when 90 then servo.max
    when 180 then servo.min
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
artoo-arduino-1.4.4 examples/servo.rb
artoo-arduino-1.4.3 examples/servo.rb