Skip to content

HTTPS clone URL

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"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
RAD
</title>
<script src="javascripts/rounded_corners_lite.inc.js" type="text/javascript"></script>
<style>
.movie {float: left; margin-right: 10px; margin-bottom: 10px;}
</style>
<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"));
versionBox.applyCornersToAll();
}
</script>
</head>
<body>
<div id="main">
<div id="metadata">
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/rad"; return false'>
<p>Get Version</p>
<a href="http://rubyforge.org/projects/rad" class="numbers">0.2.2</a>
</div>
<div id="buy-arduino">
<h3>Sponsored by:</h3>
<h4>The Shoppe at Wulfden</h4>
<a href="http://www.wulfden.org/freeduino/freeduino.shtml">
<img src="http://www.wulfden.org/freeduino/freeduino-1.jpg" /><br />
</a>
<h4><a href="http://www.wulfden.org/freeduino/freeduino.shtml">Totally Open Arduino-Compatible Hardware</a></h4>
</div>
</div>
<h1>RAD</h1>
<h1>&#x2192; &#8216;Ruby Arduino Development&#8217;</h1>
<h2>What?</h2>
<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="http://www.youtube.com/v/AKbHcMaC_cA&hl=en"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/AKbHcMaC_cA&hl=en" 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>
</p>
<br style="clear:both" />
<h2>Why?</h2>
<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>
<h2>Installing</h2>
<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="http://www.arduino.cc/en/Main/Software">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
end
end
</pre>
<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>
<ul>
<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>
</ul>
<h2>Documentation and The Arduino <span class="caps">API</span></h2>
<p>Most of <a href="http://www.arduino.cc/en/Reference/HomePage">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="http://rad.rubyforge.org/rdoc">RAD rDocs</a>.</p>
<h2>Demo: Serial Communication</h2>
<p>
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="http://www.youtube.com/v/7OguEBfdTe0&hl=en"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/7OguEBfdTe0&hl=en" 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>
</p>
<br style="clear:both" />
<p>For more examples of <span class="caps">RAD</span> in action, see <a href="http://rad.rubyforge.org/examples">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="mailto:ruby-arduino-development@googlegroups.com">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>http://github.com/atduskgreg/rad/tree/master</code>.</p>
<h2>License</h2>
<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>
<h2>Contact</h2>
<p>Comments, questions, heckles, attacks, praises, and, (most especially) patches and contributions are welcome! Send email to <a href="mailto:ruby-arduino-development@googlegroups.com">the RAD mailing list</a>.</p>
<h2>Who</h2>
<p><a href="http://urbanhonking.com/ideasfordozens">Greg Borenstein</a> is RAD's original author and main maintainer with significant contributions from <a href="http://blog.bleything.net/">Ben Bleything</a> and <a href="http://www.wulfden.org/TheShoppe.shtml">Brian Riley</a>, patches from Scott Windsor and David Michael, and the support of the <a href="http://groups.google.com/group/ruby-arduino-development">the Ruby Arduino Development Google Group</a>.</p>
<p class="coda">
<a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>, 18th November 2007<br>
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
</p>
</div>
<!-- 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 + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-3885443-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.