A Ruby implementation of the Firmata protocol.
This library is inspired by the awesome firmata by jgautier.
Add this line to your application's Gemfile:
gem 'firmata'
And then execute:
$ bundle
Or install it yourself as:
$ gem install firmata
- Download the Arduio IDE for your OS
- Plug in your Arduino via USB
- Open the Arduino IDE, select: File > Examples > Firmata > StandardFirmata
- Click the Upload button
- Make note of the serial port: Tools > Serial Port
There have been reports of issues with Firmata 2.3. Try downgrading to Firmata 2.2 if you're having a problem.
Here is a simple example using IRB that will turn pin 13 on and off. (Replace xxxxx with the USB port from step 5 in Prerequisites)
1.9.3p194 :001 > require 'firmata'
1.9.3p194 :002 > board = Firmata::Board.new('/dev/tty.usbmodemxxxxx')
1.9.3p194 :003 > board.connect
1.9.3p194 :004 > board.connected?
=> true
1.9.3p194 :005 > board.version
=> "2.3"
1.9.3p194 :006 > board.firmware_name
=> "StandardFirmata"
1.9.3p194 :007 > board.digital_write(13, Firmata::Board::HIGH)
1.9.3p194 :008 > board.digital_write(13, Firmata::Board::LOW)
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request