-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Edgar O Silva
committed
Feb 6, 2014
1 parent
6045bb5
commit 3dd54df
Showing
3 changed files
with
760 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
source "http://rubygems.org" | ||
|
||
# Specify your gem's dependencies in artoo-arduino.gemspec | ||
gemspec | ||
#gem 'hybridgroup-firmata', path: '/path/to/hybridgroup-firmata' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
require 'artoo/commands/commands' | ||
|
||
module Artoo | ||
module Commands | ||
class Firmata < Commands | ||
package_name "firmata" | ||
|
||
desc "upload", "Uploads firmata to the arduino using avrdude" | ||
option :serial_port, aliases: '-p', default: "/dev/ttyACM0", desc: "serial port address e.g. /dev/ttyACM0" | ||
def upload | ||
part = '-patmega328p' | ||
programmer = '-carduino' | ||
baudrate = '-b115200' | ||
hexPath = File.join(File.expand_path(File.dirname(__FILE__)), "hex/StandardFirmata.cpp.hex") | ||
hexFile = "-Uflash:w:#{ hexPath }:i" | ||
case os | ||
when :linux | ||
port = "-P#{ options[:serial_port] }" | ||
run("avrdude #{ part } #{ programmer } #{ port } #{ baudrate } -D #{ hexFile }") | ||
when :macosx | ||
port = "-P#{ options[:serial_port] }" | ||
run("avrdude #{ part } #{ programmer } #{ port } #{ baudrate } -D #{ hexFile }") | ||
else | ||
say "OS not yet supported..." | ||
end | ||
end | ||
|
||
desc "install", "Install avrdude in order to be able to upload firmata to the arduino" | ||
def install | ||
case os | ||
when :linux | ||
run('sudo apt-get install avrdude') | ||
when :macosx | ||
Bundler.with_clean_env do | ||
run("brew install avrdude") | ||
end | ||
else | ||
say "OS not yet supported..." | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.