Sha256: 64477cd28baef7cfcc994c268824f1f4b36641094d81a1c5c08f26d21438f49a

Contents?: true

Size: 545 Bytes

Versions: 2

Compression:

Stored size: 545 Bytes

Contents

require 'artoo'

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

#connection :firmata, :adaptor => :firmata, :port => '/dev/tty*'
connection :firmata, :adaptor => :firmata, :port => '127.0.0.1:8023'
device :board
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}"

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
artoo-arduino-1.0.3 examples/firmata_servo.rb
artoo-arduino-1.0.2 examples/firmata_servo.rb