rad 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +11 -0
- data/bin/rad +2 -1
- data/lib/rad/arduino_sketch.rb +124 -14
- data/lib/rad/generators/makefile/makefile.erb +5 -3
- data/lib/rad/generators/makefile/makefile.rb +2 -0
- data/lib/rad/init.rb +7 -2
- data/lib/rad/tasks/build_and_make.rake +7 -5
- data/lib/rad/version.rb +2 -2
- data/website/index.html +44 -20
- data/website/index.txt +12 -17
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
== 0.2.0 2008-03-15
|
2
|
+
* 8ish updates, some major:
|
3
|
+
* fixed regular serial support
|
4
|
+
* class method for writing functions in assembler
|
5
|
+
* applied Scott Windsor's patch for software serial support
|
6
|
+
* added support for HIGH/LOW/ON/OFF constants
|
7
|
+
* add an option for skipping the reset prompt on rake make:upload
|
8
|
+
* changed default arduino location to be more realistic
|
9
|
+
* put screencasts #1 and #2 on rad.rubyforge.org
|
10
|
+
* put google analytics on rad.rubyforge.org
|
11
|
+
|
1
12
|
== 0.1.1 2007-10-29
|
2
13
|
* 2 major fixes:
|
3
14
|
* explicitly specify path to arduino avr tools (this was broken on systems that didn't have the avr toolchain installed, oops)
|
data/bin/rad
CHANGED
@@ -54,13 +54,14 @@ File.open("#{sketch_name}/config/hardware.yml", 'w') do |file|
|
|
54
54
|
file << <<-EOS
|
55
55
|
serial_port: /dev/tty.usbserial*
|
56
56
|
mcu: atmega168
|
57
|
+
physical_reset: false
|
57
58
|
EOS
|
58
59
|
end
|
59
60
|
puts "Added #{sketch_name}/config/hardware.yml"
|
60
61
|
|
61
62
|
File.open("#{sketch_name}/config/software.yml", 'w') do |file|
|
62
63
|
file << <<-EOS
|
63
|
-
arduino_root: /Applications/arduino
|
64
|
+
arduino_root: /Applications/arduino-0010
|
64
65
|
EOS
|
65
66
|
end
|
66
67
|
puts "Added #{sketch_name}/config/software.yml"
|
data/lib/rad/arduino_sketch.rb
CHANGED
@@ -1,13 +1,10 @@
|
|
1
|
-
# TOOD:
|
2
|
-
# ON and OFF
|
3
|
-
# HIGH and LOW
|
4
|
-
|
5
1
|
class ArduinoSketch
|
6
2
|
def initialize
|
7
3
|
@declarations = []
|
8
4
|
@pin_modes = {:output => [], :input => []}
|
9
5
|
@pullups = []
|
10
6
|
@other_setup = [] # specifically, Serial.begin
|
7
|
+
@assembler_declarations = []
|
11
8
|
@accessors = []
|
12
9
|
@signatures = ["void blink();", "int main();"]
|
13
10
|
|
@@ -21,6 +18,37 @@ class ArduinoSketch
|
|
21
18
|
@helper_methods = helper_methods.join( "\n" )
|
22
19
|
end
|
23
20
|
|
21
|
+
def vars(opts={})
|
22
|
+
opts.each do |k,v|
|
23
|
+
if v.class == Symbol
|
24
|
+
@declarations << "#{v} _#{k};"
|
25
|
+
@accessors << <<-CODE
|
26
|
+
#{v} #{k}(){
|
27
|
+
\treturn _#{k};
|
28
|
+
}
|
29
|
+
CODE
|
30
|
+
else
|
31
|
+
type = case v
|
32
|
+
when Integer
|
33
|
+
"int"
|
34
|
+
when String
|
35
|
+
"char*"
|
36
|
+
when TrueClass
|
37
|
+
"bool"
|
38
|
+
when FalseClass
|
39
|
+
"bool"
|
40
|
+
end
|
41
|
+
#vars need to be underscored...accessors not
|
42
|
+
@declarations << "#{type} _#{k} = #{v};"
|
43
|
+
@accessors << <<-CODE
|
44
|
+
#{type} #{k}(){
|
45
|
+
\treturn _#{k};
|
46
|
+
}
|
47
|
+
CODE
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
24
52
|
def output_pin(num, opts={})
|
25
53
|
raise ArgumentError, "can only define pin from Fixnum, got #{num.class}" unless num.is_a?(Fixnum)
|
26
54
|
@pin_modes[:output] << num
|
@@ -73,6 +101,39 @@ class ArduinoSketch
|
|
73
101
|
@other_setup << "Serial.begin(#{rate});"
|
74
102
|
end
|
75
103
|
|
104
|
+
def software_serial(rx, tx, opts={})
|
105
|
+
raise ArgumentError, "can only define rx from Fixnum, got #{rx.class}" unless rx.is_a?(Fixnum)
|
106
|
+
raise ArgumentError, "can only define tx from Fixnum, got #{tx.class}" unless tx.is_a?(Fixnum)
|
107
|
+
|
108
|
+
rate = opts[:rate] ? opts[:rate] : 9600
|
109
|
+
if opts[:as]
|
110
|
+
@declarations << "SoftwareSerial _#{opts[ :as ]} = SoftwareSerial(#{rx}, #{tx});"
|
111
|
+
accessor = []
|
112
|
+
accessor << "SoftwareSerial& #{opts[ :as ]}() {"
|
113
|
+
accessor << "\treturn _#{opts[ :as ]};"
|
114
|
+
accessor << "}"
|
115
|
+
accessor << "int read(SoftwareSerial& s) {"
|
116
|
+
accessor << "\treturn s.read();"
|
117
|
+
accessor << "}"
|
118
|
+
accessor << "void println( SoftwareSerial& s, char* str ) {"
|
119
|
+
accessor << "\treturn s.println( str );"
|
120
|
+
accessor << "}"
|
121
|
+
accessor << "void print( SoftwareSerial& s, char* str ) {"
|
122
|
+
accessor << "\treturn s.print( str );"
|
123
|
+
accessor << "}"
|
124
|
+
accessor << "void println( SoftwareSerial& s, int i ) {"
|
125
|
+
accessor << "\treturn s.println( i );"
|
126
|
+
accessor << "}"
|
127
|
+
accessor << "void print( SoftwareSerial& s, int i ) {"
|
128
|
+
accessor << "\treturn s.print( i );"
|
129
|
+
accessor << "}"
|
130
|
+
@accessors << accessor.join( "\n" )
|
131
|
+
|
132
|
+
@signatures << "SoftwareSerial& #{opts[ :as ]}();"
|
133
|
+
|
134
|
+
@other_setup << "_#{opts[ :as ]}.begin(#{rate});"
|
135
|
+
end
|
136
|
+
end
|
76
137
|
|
77
138
|
def compose_setup # also composes headers and signatures
|
78
139
|
result = []
|
@@ -80,6 +141,7 @@ class ArduinoSketch
|
|
80
141
|
result << comment_box( "Auto-generated by RAD" )
|
81
142
|
|
82
143
|
result << "#include <WProgram.h>\n"
|
144
|
+
result << "#include <SoftwareSerial.h>\n"
|
83
145
|
|
84
146
|
result << comment_box( 'method signatures' )
|
85
147
|
result << "void loop();"
|
@@ -91,6 +153,15 @@ class ArduinoSketch
|
|
91
153
|
result << "" # blank line
|
92
154
|
@accessors.each {|ac| result << ac}
|
93
155
|
|
156
|
+
result << "\n" + comment_box( "assembler declarations" )
|
157
|
+
unless @assembler_declarations.empty?
|
158
|
+
result << <<-CODE
|
159
|
+
extern "C" {
|
160
|
+
#{@assembler_declarations.join("\n")}
|
161
|
+
}
|
162
|
+
CODE
|
163
|
+
end
|
164
|
+
|
94
165
|
result << "\n" + comment_box( "setup" )
|
95
166
|
result << "void setup() {"
|
96
167
|
result << "\t// pin modes"
|
@@ -102,7 +173,7 @@ class ArduinoSketch
|
|
102
173
|
end
|
103
174
|
|
104
175
|
@pullups.each do |pin|
|
105
|
-
|
176
|
+
result << "\tdigitalWrite( #{pin}, HIGH ); // enable pull-up resistor for input"
|
106
177
|
end
|
107
178
|
|
108
179
|
unless @other_setup.empty?
|
@@ -132,32 +203,71 @@ class ArduinoSketch
|
|
132
203
|
return result.join( "\n" )
|
133
204
|
end
|
134
205
|
|
206
|
+
def assembler(name, declaration, code)
|
207
|
+
@assembler_declarations << declaration
|
208
|
+
assembler_code = <<-CODE
|
209
|
+
.file "#{name}.S"
|
210
|
+
.arch #{Makefile.hardware_params['mcu']}
|
211
|
+
.global __do_copy_data
|
212
|
+
.global __do_clear_bss
|
213
|
+
.text
|
214
|
+
.global #{name}
|
215
|
+
.type #{name}, @function
|
216
|
+
#{code}
|
217
|
+
CODE
|
218
|
+
|
219
|
+
File.open(File.expand_path("#{RAD_ROOT}") + "/#{PROJECT_DIR_NAME}/#{name}.S", "w"){|f| f << assembler_code}
|
220
|
+
end
|
221
|
+
|
222
|
+
def self.pre_process(sketch_string)
|
223
|
+
result = sketch_string
|
224
|
+
result.gsub!("HIGH", "1")
|
225
|
+
result.gsub!("LOW", "0")
|
226
|
+
result.gsub!("ON", "1")
|
227
|
+
result.gsub!("OFF", "0")
|
228
|
+
result
|
229
|
+
end
|
230
|
+
|
135
231
|
private
|
136
232
|
|
137
233
|
def serial_boilerplate
|
138
|
-
# TODO:
|
139
|
-
# serial_print and serial_println need signatures for every combination of argument options
|
140
234
|
out = []
|
141
235
|
out << "int serial_available() {"
|
142
236
|
out << "\treturn (Serial.available() > 0);"
|
143
237
|
out << "}"
|
144
238
|
|
145
|
-
out << "
|
146
|
-
out << "\treturn Serial.read();"
|
239
|
+
out << "char serial_read() {"
|
240
|
+
out << "\treturn (char) Serial.read();"
|
147
241
|
out << "}"
|
148
242
|
|
149
243
|
out << "void serial_flush() {"
|
150
244
|
out << "\treturn Serial.flush();"
|
151
245
|
out << "}"
|
152
246
|
|
153
|
-
out << "void
|
247
|
+
out << "void serial_print( char str ) {"
|
248
|
+
out << "\treturn Serial.print( str );"
|
249
|
+
out << "}"
|
250
|
+
|
251
|
+
out << "void serial_print( char* str ) {"
|
154
252
|
out << "\treturn Serial.print( str );"
|
155
253
|
out << "}"
|
254
|
+
|
255
|
+
out << "void serial_print( int i ) {"
|
256
|
+
out << "\treturn Serial.print( i );"
|
257
|
+
out << "}"
|
258
|
+
|
259
|
+
out << "void serial_println( char* str ) {"
|
260
|
+
out << "\treturn Serial.println( str );"
|
261
|
+
out << "}"
|
262
|
+
|
263
|
+
out << "void serial_println( char str ) {"
|
264
|
+
out << "\treturn Serial.println( str );"
|
265
|
+
out << "}"
|
266
|
+
|
267
|
+
out << "void serial_println( int i ) {"
|
268
|
+
out << "\treturn Serial.println( i );"
|
269
|
+
out << "}"
|
156
270
|
|
157
|
-
# void serial_print()
|
158
|
-
# void serial_println()
|
159
|
-
# Serial.print(data)
|
160
|
-
# Serial.println(data)
|
161
271
|
return out.join( "\n" )
|
162
272
|
end
|
163
273
|
|
@@ -63,12 +63,14 @@
|
|
63
63
|
PORT = <%= params['serial_port'] %>
|
64
64
|
TARGET = <%= params['target'] %>
|
65
65
|
ARDUINO = <%= params['arduino_root'] %>/hardware/cores/arduino
|
66
|
+
SOFTWARE_SERIAL = <%= params['arduino_root'] %>/hardware/libraries/SoftwareSerial
|
66
67
|
SRC = $(ARDUINO)/pins_arduino.c $(ARDUINO)/wiring.c \
|
67
68
|
$(ARDUINO)/wiring_analog.c $(ARDUINO)/wiring_digital.c \
|
68
69
|
$(ARDUINO)/wiring_pulse.c $(ARDUINO)/wiring_serial.c \
|
69
70
|
$(ARDUINO)/wiring_shift.c $(ARDUINO)/WInterrupts.c
|
70
|
-
CXXSRC = $(ARDUINO)/HardwareSerial.cpp $(ARDUINO)/WRandom.cpp
|
71
|
+
CXXSRC = $(ARDUINO)/HardwareSerial.cpp $(ARDUINO)/WRandom.cpp $(SOFTWARE_SERIAL)/SoftwareSerial.cpp
|
71
72
|
MCU = <%= params['mcu'] %>
|
73
|
+
<% if params['asm_files'] %>ASRC = <%= params['asm_files'].join(' ') %><% end %>
|
72
74
|
F_CPU = 16000000
|
73
75
|
FORMAT = ihex
|
74
76
|
UPLOAD_RATE = 19200
|
@@ -89,8 +91,8 @@ CDEFS = -DF_CPU=$(F_CPU)
|
|
89
91
|
CXXDEFS = -DF_CPU=$(F_CPU)
|
90
92
|
|
91
93
|
# Place -I options here
|
92
|
-
CINCS = -I$(ARDUINO)
|
93
|
-
CXXINCS = -I$(ARDUINO)
|
94
|
+
CINCS = -I$(ARDUINO) -I$(SOFTWARE_SERIAL)
|
95
|
+
+CXXINCS = -I$(ARDUINO) -I$(SOFTWARE_SERIAL)
|
94
96
|
|
95
97
|
# Compiler flag to set the C Standard level.
|
96
98
|
# c89 - "ANSI" C
|
@@ -8,6 +8,8 @@ class Makefile
|
|
8
8
|
params = hardware_params.merge software_params
|
9
9
|
params['target'] = sketch_name
|
10
10
|
|
11
|
+
params['asm_files'] = Dir.entries( File.expand_path(RAD_ROOT) + "/" + PROJECT_DIR_NAME ).select{|e| e =~ /\.S/}
|
12
|
+
|
11
13
|
e = ERB.new File.read("#{File.dirname(__FILE__)}/makefile.erb")
|
12
14
|
|
13
15
|
File.open("#{RAD_ROOT}/#{sketch_name}/Makefile", "w") do |f|
|
data/lib/rad/init.rb
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
RAD_ROOT = "#{File.dirname(__FILE__)}/../.." unless defined?(RAD_ROOT)
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
unless defined?(PROJECT_DIR_NAME)
|
4
|
+
a = File.expand_path(File.expand_path("#{RAD_ROOT}")).split("/")
|
5
|
+
PROJECT_DIR_NAME = a[a.length-1]
|
6
|
+
end
|
7
|
+
|
8
|
+
|
9
|
+
%w(generators/makefile/makefile.rb arduino_sketch.rb tasks/rad.rb).each do |path|
|
5
10
|
require File.expand_path("#{RAD_ROOT}/vendor/rad/#{path}")
|
6
11
|
end
|
7
12
|
|
@@ -5,16 +5,18 @@ namespace :make do
|
|
5
5
|
|
6
6
|
desc "compile the sketch and then upload it to your Arduino board"
|
7
7
|
task :upload => :compile do
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
if Makefile.hardware_params['physical_reset']
|
9
|
+
puts "Reset the Arduino and hit enter.\n==If your board doesn't need it, you can turn off this prompt in config/software.yml=="
|
10
|
+
STDIN.gets.chomp
|
11
|
+
end
|
12
|
+
sh %{cd #{RAD_ROOT}/#{@sketch_name}; make upload}
|
11
13
|
end
|
12
14
|
|
13
15
|
desc "generate a makefile and use it to compile the .cpp"
|
14
16
|
task :compile => [:clean_sketch_dir, "build:sketch"] do # should also depend on "build:sketch"
|
15
17
|
Makefile.compose_for_sketch( @sketch_name )
|
16
18
|
# not allowed? sh %{export PATH=#{Makefile.software_params[:arduino_root]}/tools/avr/bin:$PATH}
|
17
|
-
sh %{cd #{RAD_ROOT}/#{@sketch_name}; make}
|
19
|
+
sh %{cd #{RAD_ROOT}/#{@sketch_name}; make depend; make}
|
18
20
|
end
|
19
21
|
|
20
22
|
task :clean_sketch_dir => ["build:file_list", "build:sketch_dir"] do
|
@@ -31,7 +33,7 @@ namespace :build do
|
|
31
33
|
desc "actually build the sketch"
|
32
34
|
task :sketch => [:file_list, :sketch_dir, :setup] do
|
33
35
|
klass = @file_names.first.split(".").first.split("_").collect{|c| c.capitalize}.join("")
|
34
|
-
eval File.read(@file_names.first)
|
36
|
+
eval ArduinoSketch.pre_process(File.read(@file_names.first))
|
35
37
|
@loop = RubyToAnsiC.translate(constantize(klass), "loop")
|
36
38
|
result = "#{@setup}\n#{@loop}\n"
|
37
39
|
name = @file_names.first.split(".").first
|
data/lib/rad/version.rb
CHANGED
data/website/index.html
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
</title>
|
10
10
|
<script src="javascripts/rounded_corners_lite.inc.js" type="text/javascript"></script>
|
11
11
|
<style>
|
12
|
-
|
12
|
+
.movie {float: left; margin-right: 10px; margin-bottom: 10px;}
|
13
13
|
</style>
|
14
14
|
<script type="text/javascript">
|
15
15
|
window.onload = function() {
|
@@ -33,7 +33,7 @@
|
|
33
33
|
<h1>RAD</h1>
|
34
34
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/rad"; return false'>
|
35
35
|
<p>Get Version</p>
|
36
|
-
<a href="http://rubyforge.org/projects/rad" class="numbers">0.0
|
36
|
+
<a href="http://rubyforge.org/projects/rad" class="numbers">0.2.0</a>
|
37
37
|
</div>
|
38
38
|
<h1>→ ‘Ruby Arduino Development’</h1>
|
39
39
|
|
@@ -43,7 +43,13 @@
|
|
43
43
|
|
44
44
|
<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>
|
45
45
|
|
46
|
+
<h2>Demo: 'Hello World'</h2>
|
46
47
|
|
48
|
+
<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.
|
49
|
+
<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>
|
50
|
+
<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>
|
51
|
+
</p>
|
52
|
+
<br style="clear:both" />
|
47
53
|
<h2>Why?</h2>
|
48
54
|
|
49
55
|
|
@@ -53,17 +59,17 @@
|
|
53
59
|
<h2>Installing</h2>
|
54
60
|
|
55
61
|
|
56
|
-
<
|
62
|
+
<p><code>$ sudo gem install rad</code></p>
|
63
|
+
|
57
64
|
|
58
|
-
<p
|
65
|
+
<p>You’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 0010, but we try to keep it up-to-date with new Arduino releases.</p>
|
59
66
|
|
60
67
|
|
61
|
-
<
|
68
|
+
<h2>The Basics</h2>
|
62
69
|
|
63
|
-
<h2>The basics</h2>
|
64
70
|
|
71
|
+
<p><code>$ rad my_sketch</code></p>
|
65
72
|
|
66
|
-
<code>$ rad my_sketch</code>
|
67
73
|
|
68
74
|
<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 ‘hello world’ script in <span class="caps">RAD</span> will look like this:</p>
|
69
75
|
|
@@ -77,28 +83,38 @@ class MySketch < ArduinoSketch
|
|
77
83
|
end
|
78
84
|
</pre>
|
79
85
|
|
80
|
-
<p>Once your code is written, your relevant local configuration properly setup in config/hardware.rb and config/
|
86
|
+
<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>
|
87
|
+
|
81
88
|
|
89
|
+
<p><code>$ rake make:upload</code></p>
|
82
90
|
|
83
|
-
<code>$ rake make:upload</code>
|
84
91
|
|
85
92
|
<p>This will:</p>
|
86
93
|
|
87
94
|
|
88
|
-
<ul>
|
89
|
-
<li>generate the correct Arduino C
|
90
|
-
<li>dynamically prepare a localized version of the default Arduino
|
91
|
-
<li>compile your
|
92
|
-
<li>prompt you to hit the reset button on your Arduino
|
93
|
-
<li>upload your compiled binary onto your Arduino</li>
|
94
|
-
</ul>
|
95
|
+
<ul>
|
96
|
+
<li>generate the correct Arduino C++ code from your sketch</li>
|
97
|
+
<li>dynamically prepare a localized version of the default Arduino Makefile</li>
|
98
|
+
<li>compile your sketch</li>
|
99
|
+
<li>prompt you to hit the reset button on your Arduino (if necessary!)</li>
|
100
|
+
<li>upload your compiled binary onto your Arduino</li>
|
101
|
+
</ul>
|
102
|
+
|
95
103
|
|
96
104
|
<h2>The Arduino <span class="caps">API</span></h2>
|
97
105
|
|
98
106
|
|
99
|
-
<p>
|
107
|
+
<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 the Ruby versions of the methods is forthcoming, but it is mostly what you’d expect: methods with identical names and arguments to their Arduino counterparts with the exception of using ‘true’ and ‘false’ for <span class="caps">HIGH</span> and <span class="caps">LOW</span>.</p>
|
100
108
|
|
109
|
+
<h2>Demo: Serial Communication</h2>
|
110
|
+
<p>
|
111
|
+
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.
|
112
|
+
<div class="movie">
|
113
|
+
<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>
|
101
114
|
|
115
|
+
<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>
|
116
|
+
</p>
|
117
|
+
<br style="clear:both" />
|
102
118
|
<h2><span class="caps">RAD</span> Needs You!</h2>
|
103
119
|
|
104
120
|
|
@@ -114,7 +130,7 @@ end
|
|
114
130
|
<h2>License</h2>
|
115
131
|
|
116
132
|
|
117
|
-
<p>This code is free to use under the terms of the <span class="caps">GPL 2
|
133
|
+
<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>
|
118
134
|
|
119
135
|
|
120
136
|
<h2>Contact</h2>
|
@@ -122,12 +138,20 @@ end
|
|
122
138
|
|
123
139
|
<p>Comments, questions, heckles, attacks, praises, and, (most especially) patches and contributions are welcome! Send email to <a href="mailto:greg@grabb.it">Greg Borenstein</a>.</p>
|
124
140
|
<p class="coda">
|
125
|
-
<a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>,
|
141
|
+
<a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>, 18th November 2007<br>
|
126
142
|
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
127
143
|
</p>
|
128
144
|
</div>
|
129
145
|
|
130
146
|
<!-- insert site tracking codes here, like Google Urchin -->
|
131
|
-
|
147
|
+
<script type="text/javascript">
|
148
|
+
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
149
|
+
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
150
|
+
</script>
|
151
|
+
<script type="text/javascript">
|
152
|
+
var pageTracker = _gat._getTracker("UA-3885443-1");
|
153
|
+
pageTracker._initData();
|
154
|
+
pageTracker._trackPageview();
|
155
|
+
</script>
|
132
156
|
</body>
|
133
157
|
</html>
|
data/website/index.txt
CHANGED
@@ -2,7 +2,6 @@ h1. RAD
|
|
2
2
|
|
3
3
|
h1. → 'Ruby Arduino Development'
|
4
4
|
|
5
|
-
|
6
5
|
h2. What?
|
7
6
|
|
8
7
|
RAD is a framework for programming the Arduino physcial computing platform using Ruby. RAD 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.
|
@@ -13,15 +12,13 @@ While duplicating the functionality of the well-designed Arduino software interf
|
|
13
12
|
|
14
13
|
h2. Installing
|
15
14
|
|
16
|
-
|
17
|
-
|
18
|
-
RAD depends on <a href="http://rubyforge.org/projects/ruby2c/">Ruby2C</a>, which seems immune to the normal gem requirement techniques, so, if you don't already have it, you'll need to install that as well:
|
15
|
+
@$ sudo gem install rad@
|
19
16
|
|
20
|
-
|
17
|
+
You'll also need to have the Arduino environment installed, which you can get from "the Arduino website":http://www.arduino.cc/en/Main/Software. RAD currently requires Arduino 0010, but we try to keep it up-to-date with new Arduino releases.
|
21
18
|
|
22
|
-
h2. The
|
19
|
+
h2. The Basics
|
23
20
|
|
24
|
-
|
21
|
+
@$ rad my_sketch@
|
25
22
|
|
26
23
|
This command will create a new RAD project directory (my_sketch/) inside of the current directory that contains a blank script in which you can write your own RAD code, as well as a full install of the RAD support infrastructure (in vendor/). A sample 'hello world' script in RAD will look like this:
|
27
24
|
|
@@ -34,19 +31,17 @@ class MySketch < ArduinoSketch
|
|
34
31
|
end
|
35
32
|
</pre>
|
36
33
|
|
37
|
-
Once your code is written, your relevant local configuration properly setup in config/hardware.rb and config/
|
34
|
+
Once your code is written, your relevant local configuration properly setup in @config/hardware.rb@ and @config/software.rb@, and an Arduino with the corresponding circuit (a 220ohm resistor and an LED wired in series between Arduino pin 7 and ground) is connected to your computer via serial, run:
|
38
35
|
|
39
|
-
|
36
|
+
@$ rake make:upload@
|
40
37
|
|
41
38
|
This will:
|
42
39
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
<li>upload your compiled binary onto your Arduino</li>
|
49
|
-
</ul>
|
40
|
+
* generate the correct Arduino C++ code from your sketch
|
41
|
+
* dynamically prepare a localized version of the default Arduino Makefile
|
42
|
+
* compile your sketch
|
43
|
+
* prompt you to hit the reset button on your Arduino (if necessary!)
|
44
|
+
* upload your compiled binary onto your Arduino
|
50
45
|
|
51
46
|
h2. The Arduino API
|
52
47
|
|
@@ -58,7 +53,7 @@ All the many discipline-crossing skills required for a project like RAD make for
|
|
58
53
|
|
59
54
|
There's lots to do.
|
60
55
|
|
61
|
-
If you're looking for a place to dive in and don't know quite where, "email Greg":mailto:greg@grabb.it. If you want to start by taking a log at the code, the trunk repository is
|
56
|
+
If you're looking for a place to dive in and don't know quite where, "email Greg":mailto:greg@grabb.it. If you want to start by taking a log at the code, the trunk repository is @svn://rubyforge.org/var/svn/rad/trunk@ for anonymous access.
|
62
57
|
|
63
58
|
h2. License
|
64
59
|
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: rad
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date:
|
6
|
+
version: 0.2.0
|
7
|
+
date: 2008-03-16 00:00:00 -07:00
|
8
8
|
summary: A framework for programming the Arduino physcial computing platform using Ruby. RAD 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.
|
9
9
|
require_paths:
|
10
10
|
- lib
|