Skip to content

Instantly share code, notes, and snippets.

@hoasung01
Created January 21, 2016 10:16
Show Gist options
  • Save hoasung01/934d95f68d5415d91862 to your computer and use it in GitHub Desktop.
Save hoasung01/934d95f68d5415d91862 to your computer and use it in GitHub Desktop.
raspi_button_led.rb
require 'artoo'
connection :arduino, :adaptor => :firmata, :port => '/dev/ttyACM0'
device :led, :driver => :led, :pin => 13
device :button, :driver => :button, :pin => 2
work do
on button, :push => proc {led.toggle}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment