austinbv / dino

Dino is a ruby gem that helps you bootstrap prototyping with an Arduino
MIT License
388 stars 84 forks source link

Question: Can I Burn the Ruby Script to Arduino Device? #49

Closed joelbyler closed 11 years ago

joelbyler commented 11 years ago

How can I burn my ruby script to the device so it will run automatically the next time it is powered up (not connected to my computer).

I think normally an arduino will start executing the last sketch that was 'uploaded' to it when it is powered on. When I use dino to write my sketches in ruby, it doesn't really seem to do anything. Is there a way to do this in ruby or is it a limitation of this approach?

vickash commented 11 years ago

No. This gem isn't about transcompiling Ruby code to Arduino code. All the included Arduino bootstrapper does is provide an API for calling low-level Arduino functions and libraries over a serial connection. The Ruby gem wraps this API and adds logic for common components. All your program logic is in Ruby and needs the board to be connected.

The bootstrapper is written as an Arduino library, so what you're asking might be possible. Try this:

In theory, that will give you a board with the standalone functionality you transcompiled and burnt onto it, while still being able to control it over serial with the dino API. Replacing everything in loop will let you disable external control.

Check out rad for Ruby -> Arduino transcompiling: https://github.com/atduskgreg/rad