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.expand_path(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
|