Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 353a9f4040
Fetching contributors…

Cannot retrieve contributors at this time

179 lines (120 sloc) 9.235 kb
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="" xml:lang="en" lang="en">
<link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="javascripts/" type="text/javascript"></script>
.movie {float: left; margin-right: 10px; margin-bottom: 10px;}
<script type="text/javascript">
window.onload = function() {
settings = {
tl: { radius: 10 },
tr: { radius: 10 },
bl: { radius: 10 },
br: { radius: 10 },
antiAlias: true,
autoPad: true,
validTags: ["div"]
var versionBox = new curvyCorners(settings, document.getElementById("version"));
<div id="main">
<div id="metadata">
<div id="version" class="clickable" onclick='document.location = ""; return false'>
<p>Get Version</p>
<a href="" class="numbers">0.2.2</a>
<div id="buy-arduino">
<h3>Sponsored by:</h3>
<h4>The Shoppe at Wulfden</h4>
<a href="">
<img src="" /><br />
<h4><a href="">Totally Open Arduino-Compatible Hardware</a></h4>
<h1>&#x2192; &#8216;Ruby Arduino Development&#8217;</h1>
<p><span class="caps">RAD</span> is a framework for programming the Arduino physcial computing platform using Ruby. <span class="caps">RAD</span> converts Ruby scripts written using a set of Rails-like conventions and helpers into C source code which can be compiled and run on the Arduino microcontroller. It also provides a set of Rake tasks for automating the compilation and upload process.</p>
<br style="clear:both" />
<h2>Demo: 'Hello World'</h2>
<p>Here's a basic demo of <span class="caps">RAD</span> in action. In this movie, we'll write, compile, and upload the universal physical computing 'Hello World': a single flashing LED.
<div class="movie"><object width="425" height="355"><param name="movie" value=""></param><param name="wmode" value="transparent"></param><embed src="" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object></div>
<em>Note: This movie was made using an old version of the Arduino board which required a hardware reset before being able to accept a new sketch. More recent versions of the board don't have this requirement and hence as of version 0.2.0, <span class="caps">RAD</span> no longer prompts for reset when running 'rake make:upload' (thought the option is still available for older boards.)</em>
<br style="clear:both" />
<p>While duplicating the functionality of the well-designed Arduino software interface in Ruby may seem like an odd or redundant goal, <span class="caps">RAD</span> has further ambitions! Bootstrapping the ability to write microcontroller code in a high level dynamic language like Ruby could greatly ease the creation of all the luxurious development aids the users of such a language have come to expect: developer testing, platform independence, easy metaprogramming, etc.</p>
<p><code>$ sudo gem install rad</code></p>
<p>You&#8217;ll also need to have the Arduino environment installed, which you can get from <a href="">the Arduino website</a>. <span class="caps">RAD</span> currently requires Arduino 0011, but we try to keep it up-to-date with new Arduino releases.</p>
<h2>The Basics</h2>
<p><code>$ rad my_sketch</code></p>
<p>This command will create a new <span class="caps">RAD</span> project directory (my_sketch/) inside of the current directory that contains a blank script in which you can write your own <span class="caps">RAD</span> code, as well as a full install of the <span class="caps">RAD</span> support infrastructure (in vendor/). A sample &#8216;hello world&#8217; script in <span class="caps">RAD</span> will look like this:</p>
<pre syntax="ruby">
class MySketch &lt; ArduinoSketch
output_pin 7, :as =&gt; :led
def loop
blink led, 500
<p>Once your code is written, your relevant local configuration properly setup in <code>config/hardware.rb</code> and <code>config/software.rb</code>, and an Arduino with the corresponding circuit (a 220ohm resistor and an <span class="caps">LED</span> wired in series between Arduino pin 7 and ground) is connected to your computer via serial, run:</p>
<p><code>$ rake make:upload</code></p>
<p>This will:</p>
<li>generate the correct Arduino C++ code from your sketch</li>
<li>dynamically prepare a localized version of the default Arduino Makefile</li>
<li>compile your sketch</li>
<li>prompt you to hit the reset button on your Arduino (if necessary!)</li>
<li>upload your compiled binary onto your Arduino</li>
<h2>Documentation and The Arduino <span class="caps">API</span></h2>
<p>Most of <a href="">the Arduino software <span class="caps">API</span></a> should be working correctly at this point. Documentation for RAD's version of things and details about usage of the wider Arduino API are available in the <a href="">RAD rDocs</a>.</p>
<h2>Demo: Serial Communication</h2>
To demonstrate some of the more advanced features of <span class="caps">RAD</span>, here's a movie showing how to program the Arduino to listen to serial communication from a computer.
<div class="movie">
<object width="425" height="355"><param name="movie" value=""></param><param name="wmode" value="transparent"></param><embed src="" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object> </div>
<em>Note: The same comment from above applies here about the hardware reset. Also, extra points are available if you recognize the logo on the flag in the video.</em>
<br style="clear:both" />
<p>For more examples of <span class="caps">RAD</span> in action, see <a href="">the RAD example directory</a>.</p>
<h2><span class="caps">RAD</span> Needs You!</h2>
<p>All the many discipline-crossing skills required for a project like <span class="caps">RAD</span> make for lots of opportunities to help out: Have you written lots of sketches exploring the obscure depths of the Arduino library? Do you run the Arduino development tool chain on an obscure (i.e., non-OS X) platform? Do you develop for other <span class="caps">AVR</span> or <span class="caps">PIC</span> microcontrollers? Are you a C/C++ ninja? Or even C/C++ competent?</p>
<p>There&#8217;s lots to do.</p>
<p>If you&#8217;re looking for a place to dive in and don&#8217;t know quite where, <a href="">email the RAD Google Group</a>; we're friendly! If you want to start by taking a look at the code, check out RAD on GitHub: <code></code>.</p>
<p>This code is free to use under the terms of the <span class="caps">GPL</span> 2.0 license, just like the Arduino software library itself.</p>
<p>Comments, questions, heckles, attacks, praises, and, (most especially) patches and contributions are welcome! Send email to <a href="">the RAD mailing list</a>.</p>
<p><a href="">Greg Borenstein</a> is RAD's original author and main maintainer with significant contributions from <a href="">Ben Bleything</a> and <a href="">Brian Riley</a>, patches from Scott Windsor and David Michael, and the support of the <a href="">the Ruby Arduino Development Google Group</a>.</p>
<p class="coda">
<a href="">Dr Nic</a>, 18th November 2007<br>
Theme extended from <a href="">Paul Battley</a>
<!-- insert site tracking codes here, like Google Urchin -->
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "' type='text/javascript'%3E%3C/script%3E"));
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-3885443-1");
Jump to Line
Something went wrong with that request. Please try again.