Hey Jack,
I'm totally with you on the idea of emulating the Arduino in software
in order to speed up development iteration. In addition to the idea of
automated testing that was one the big motivators for me to start on
the RAD project in the first place. Once you've represented your
Arduino program in Ruby, there's no reason we can't use the language's
powerful metaprogramming features to implement your desires in other
media besides C running on the actual Arduino itself.
RubyCocoa is a really interesting thought as a platform for this
project. Another one I've considered for such a simulator is the Shoes
GUI toolkit:
http://code.whytheluckystiff.net/shoes/
It's written in Ruby and is very simple and easy to use. It also has
the advantage of being cross-platform so the resulting app would run
on Linux and Windows (where RAD itself doesn't even run). If the
project is architected correctly, there's no reason it shouldn't be
easy to implement multiple front ends to it for different needs.
Which brings me to the architecture itself: I think you'd want to
model the Arduino as a state machine so you could re-implement each
RAD command to model how it changed the internal state of the
microcontroller. You'd probably want to do this in a special simulator
sub-class that would stand where ArduinoSketch currently stands during
the compilation process. In fact this simulation back-end would
probably also form the basis for the testing framework as well.
Those are just my first thoughts, though.
A simulator has definitely been on my internal RAD roadmap so if
you're excited about this project and wanted to take up some of the
work, I'd be glad to work with you to get it started.
I hope it's alright, I've copied the Ruby Arduino Development Google
Group on this email as well so that the folks there can chime in with
their interest or ideas.
Let me know your thoughts.
yours,
Greg
---
http://grabb.it/users/greg
http://urbanhonking.com/ideasfordozens
http://atduskmusic.com
On Apr 24, 2008, at 3:41 PM, Jack Nutting wrote:
> Hi Greg,
> I have a wild idea from out in left field... I haven't done any
> Arduino development at all, but have been thinking about it, and
> today I came across your project for the first time.
> I think the idea of translating ruby to C for arduino compilation is
> really great, but it doesn't eliminate the drudgery of the edit/
> compile/run cycle that ruby lets us (in most cases) escape. How
> about this: A different mode for RAD, where instead of a lengthy
> translate/compile/transfer/run step, a user could run their code
> directly using a library that would act as a simple "arduino
> emulator", basically just providing a window with some controls to
> define inputs (e.g. checkboxes for digital inputs and sliders for
> analog inputs) and outputs (LED widgets for digital outputs, etc).
> This would probably be pretty easy to get working using RubyCocoa.
> What do you think?
> --
> :: Jack Nutting
> :: jacknutt...@mac.com
> :: http://www.nuthole.com