Created
February 1, 2015 16:17
-
-
Save avermeulen/dd71099312277eb40614 to your computer and use it in GitHub Desktop.
Blinking an LED using ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'artoo' | |
connection :arduino, adaptor: :firmata, port: '/dev/tty.usbmodem411' | |
#connection :firmata, :adaptor => :firmata, :port => '127.0.0.1:8023' | |
device :board, :driver => :device_info | |
device :led, :driver => :led, :pin => 13 | |
work do | |
puts "Firmware name: #{board.firmware_name}" | |
puts "Firmata version: #{board.version}" | |
every 1.second do | |
led.on? ? led.off : led.on | |
end | |
end |
I get the exact same behaviour
@avermeulen based on a suggestion on another thread I managed to get it working by switching from the port from '/dev/tty.usbmodem411' to '/dev/cu.usbmodem1411'
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
running this using: ruby led.rb results in:
I, [2015-02-01T18:20:36.693085 #2140] INFO -- : Registering connection 'arduino'...
I, [2015-02-01T18:20:36.693540 #2140] INFO -- : Registering device 'board'...
I, [2015-02-01T18:20:36.693710 #2140] INFO -- : Registering device 'led'...
I, [2015-02-01T18:20:36.693870 #2140] INFO -- : Preparing work...
I, [2015-02-01T18:20:36.699787 #2140] INFO -- : Initializing connection arduino...
I, [2015-02-01T18:20:36.715910 #2140] INFO -- : Initializing device board...
I, [2015-02-01T18:20:36.718452 #2140] INFO -- : Initializing device led...
I, [2015-02-01T18:20:36.764888 #2140] INFO -- : Starting work...
I, [2015-02-01T18:20:36.765457 #2140] INFO -- : Connecting to 'arduino' on port '/dev/tty.usbmodem411'...
The LED blinks as it initialize but nothing happens after that...
The same happens if I run it with:
artoo start led.rb