diff options
author | Jenna Fox <a@creativepony.com> | 2012-09-30 14:22:04 +1000 |
---|---|---|
committer | Jenna Fox <a@creativepony.com> | 2012-09-30 14:22:04 +1000 |
commit | 4ab39b1d0cdcbac838d2d15acd532493a33a3764 (patch) | |
tree | 972c70655fd58638eb487048981e6e3b4154b3e7 /ruby/upload.rb | |
parent | d919861396dd343bcc7132b6358b3a286228cc89 (diff) | |
download | micronucleus-4ab39b1d0cdcbac838d2d15acd532493a33a3764.tar.gz micronucleus-4ab39b1d0cdcbac838d2d15acd532493a33a3764.tar.bz2 micronucleus-4ab39b1d0cdcbac838d2d15acd532493a33a3764.zip |
cleaning up directory structures
Diffstat (limited to 'ruby/upload.rb')
-rw-r--r-- | ruby/upload.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/ruby/upload.rb b/ruby/upload.rb new file mode 100644 index 0000000..32aefa9 --- /dev/null +++ b/ruby/upload.rb @@ -0,0 +1,33 @@ +require_relative './micronucleus' + +if ARGV[0] + if ARGV[0].end_with? '.hex' + puts "parsing input file as intel hex" + test_data = HexProgram.new(open ARGV[0]).binary + else + puts "parsing input file as raw binary" + test_data = open(ARGV[0]).read + end +else + raise "Pass intel hex or raw binary as argument to script" +end + +#test_data += ("\xFF" * 64) + +puts "Plug in programmable device now: (waiting)" +sleep 0.25 while Micronucleus.all.length == 0 + +nucleus = Micronucleus.all.first +puts "Attached to device: #{nucleus.inspect}" + +#puts "Attempting to write '#{test_data.inspect}' to first thinklet's program memory" +#puts "Bytes: #{test_data.bytes.to_a.inspect}" +sleep(0.25) # some time to think? +puts "Attempting to write supplied program in to device's memory" +nucleus.program = test_data + +puts "Great! Starting program..." + + +nucleus.finished # let thinklet know it can go do other things now if it likes +puts "All done!" |