Sha256: 16bcedfe53ee7eda0365a76ecf79180c0f7aab559b888e6caf03094717030e2a

Contents?: true

Size: 500 Bytes

Versions: 2

Compression:

Stored size: 500 Bytes

Contents

require 'artoo'

# Circuit and schematic here: http://arduino.cc/en/tutorial/button

connection :firmata, :adaptor => :firmata, :port => '/dev/ttyACM0' # linux
#connection :firmata, :adaptor => :firmata, :port => '127.0.0.1:8023'
device :led, :driver => :led, :pin => 13
device :button, :driver => :button, :pin => 2, :interval => 0.01

work do
  puts
  puts "Press the button connected on pin #{button.pin}..."

  on button, :push    => proc { led.on }
  on button, :release => proc { led.off }
end

Version data entries

2 entries across 2 versions & 1 rubygems

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