Skip to content

Instantly share code, notes, and snippets.

@scalone
Created September 18, 2015 13:54
Show Gist options
  • Save scalone/6ecc497ecb257f19b8dc to your computer and use it in GitHub Desktop.
Save scalone/6ecc497ecb257f19b8dc to your computer and use it in GitHub Desktop.
require 'artoo'
connection :arduino, adaptor: :firmata, port: '/dev/ttyACM0'
device :led, driver: :led, pin: 13
device :button, driver: :button, pin: 2, interval: 0.01
work do
puts "Press the button connected on pin #{ button.pin }..."
on button, :push => proc { led.on }
on button, :release => proc { led.off }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment