Class: Artoo::Commands::Firmata
- Inherits:
-
Artoo::Commands
- Object
- Artoo::Commands
- Artoo::Commands::Firmata
- Defined in:
- lib/artoo/commands/firmata.rb
Direct Known Subclasses
Instance Method Summary collapse
Instance Method Details
#install ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/artoo/commands/firmata.rb', line 27 def install case os when :linux run('sudo apt-get install avrdude') when :macosx require 'bundler' unless defined?(Bundler) Bundler.with_clean_env do run("brew install avrdude") end else say "OS not yet supported..." end end |
#upload(address) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/artoo/commands/firmata.rb', line 9 def upload(address) part = '-patmega328p' programmer = '-carduino' baudrate = '-b115200' hex_path = File.join(File.(File.dirname(__FILE__)), "StandardFirmata.cpp.hex") hex_file = "-Uflash:w:#{ hex_path }:i" port = (address[/[\/\:]/].nil?) ? "-P/dev/#{ address }" : "-P#{ address }" case os when :linux run("avrdude #{ part } #{ programmer } #{ port } #{ baudrate } -D #{ hex_file }") when :macosx run("avrdude #{ part } #{ programmer } #{ port } #{ baudrate } -D #{ hex_file }") else say "OS not yet supported..." end end |