Sha256: afdd4f2ded16093fe4be86bc122c300753efad1a517d54fd0894162f3a34f12e

Contents?: true

Size: 640 Bytes

Versions: 1

Compression:

Stored size: 640 Bytes

Contents

require 'artoo'

#Circuit's breadboard layout here: http://learn.adafruit.com/adafruit-arduino-lesson-13-dc-motors/breadboard-layout

#connection :firmata, :adaptor => :firmata, :port => '/dev/tty*'
connection :firmata, :adaptor => :firmata, :port => '127.0.0.1:8023'
device :board, :driver => :board
device :motor, :driver => :motor, :switch_pin => 3 # Use a digital or PWM pin

work do
  puts "Firmware name: #{board.firmware_name}"
  puts "Firmata version: #{board.version}"
  puts "Stopping motor..." #just in case
  motor.stop
  sleep 3

  every 3.seconds do
    motor.toggle
    puts "Motor is #{motor.on? ? 'on' : 'off'}"
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
artoo-arduino-1.1.0 examples/firmata_dc_motor_switch.rb