rad 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +4 -0
- data/bin/rad +1 -1
- data/lib/rad/arduino_sketch.rb +8 -0
- data/lib/rad/generators/makefile/makefile.erb +1 -1
- data/lib/rad/version.rb +1 -1
- data/website/examples/assembler_test.rb.html +73 -0
- data/website/examples/gps_reader.rb.html +39 -0
- data/website/examples/hello_world.rb.html +38 -0
- data/website/examples/serial_motor.rb.html +41 -0
- data/website/index.html +12 -6
- metadata +6 -2
data/Manifest.txt
CHANGED
@@ -26,3 +26,7 @@ website/index.txt
|
|
26
26
|
website/javascripts/rounded_corners_lite.inc.js
|
27
27
|
website/stylesheets/screen.css
|
28
28
|
website/template.rhtml
|
29
|
+
website/examples/assembler_test.rb.html
|
30
|
+
website/examples/gps_reader.rb.html
|
31
|
+
website/examples/hello_world.rb.html
|
32
|
+
website/examples/serial_motor.rb.html
|
data/bin/rad
CHANGED
data/lib/rad/arduino_sketch.rb
CHANGED
@@ -497,6 +497,10 @@ class ArduinoSketch
|
|
497
497
|
|
498
498
|
out << "void serial_print( int i ) {"
|
499
499
|
out << "\treturn Serial.print( i );"
|
500
|
+
out << "}"
|
501
|
+
|
502
|
+
out << "void serial_print( long i ) {"
|
503
|
+
out << "\treturn Serial.print( i );"
|
500
504
|
out << "}"
|
501
505
|
|
502
506
|
out << "void serial_println( char* str ) {"
|
@@ -510,6 +514,10 @@ class ArduinoSketch
|
|
510
514
|
out << "void serial_println( int i ) {"
|
511
515
|
out << "\treturn Serial.println( i );"
|
512
516
|
out << "}"
|
517
|
+
|
518
|
+
out << "void serial_println( long i ) {"
|
519
|
+
out << "\treturn Serial.println( i );"
|
520
|
+
out << "}"
|
513
521
|
|
514
522
|
return out.join( "\n" )
|
515
523
|
end
|
@@ -69,7 +69,7 @@ SRC = $(ARDUINO)/pins_arduino.c $(ARDUINO)/wiring.c \
|
|
69
69
|
$(ARDUINO)/wiring_analog.c $(ARDUINO)/wiring_digital.c \
|
70
70
|
$(ARDUINO)/wiring_pulse.c $(ARDUINO)/wiring_serial.c \
|
71
71
|
$(ARDUINO)/wiring_shift.c $(ARDUINO)/WInterrupts.c
|
72
|
-
CXXSRC = $(ARDUINO)/HardwareSerial.cpp $(
|
72
|
+
CXXSRC = $(ARDUINO)/HardwareSerial.cpp $(SOFTWARE_SERIAL)/SoftwareSerial.cpp<%= params['libraries'].collect{|l| " $(LIBRARY_ROOT)/#{ l }/#{l }.cpp"}.join('') %>
|
73
73
|
MCU = <%= params['mcu'] %>
|
74
74
|
<% if params['asm_files'] %>ASRC = <%= params['asm_files'].join(' ') %><% end %>
|
75
75
|
F_CPU = 16000000
|
data/lib/rad/version.rb
CHANGED
@@ -0,0 +1,73 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>assembler_test.rb.html</title
|
4
|
+
<style type="text/css">
|
5
|
+
|
6
|
+
.ruby .normal {}
|
7
|
+
.ruby .comment { color: #888; font-style: italic; }
|
8
|
+
.ruby .keyword { color: #A00; font-weight: bold; }
|
9
|
+
.ruby .method { color: #077; }
|
10
|
+
.ruby .class { color: #074; }
|
11
|
+
.ruby .module { color: #050; }
|
12
|
+
.ruby .punct { color: #447; font-weight: bold; }
|
13
|
+
.ruby .symbol { color: #099; }
|
14
|
+
.ruby .string { color: #944; }
|
15
|
+
.ruby .char { color: #F07; }
|
16
|
+
.ruby .ident { color: #004; }
|
17
|
+
.ruby .constant { color: #07F; }
|
18
|
+
.ruby .regex { color: #B66; }
|
19
|
+
.ruby .number { color: #D55; }
|
20
|
+
.ruby .attribute { color: #377; }
|
21
|
+
.ruby .global { color: #3B7; }
|
22
|
+
.ruby .expr { color: #227; }
|
23
|
+
</style>
|
24
|
+
</head>
|
25
|
+
<body>
|
26
|
+
<pre class="ruby">
|
27
|
+
<pre><span class="comment"># Hardware: Connect to serial output with screen:</span>
|
28
|
+
<span class="comment"># $ screen /dev/tty/path.to.your.usb 9600</span>
|
29
|
+
|
30
|
+
<span class="keyword">class </span><span class="class">AssemblerTest</span> <span class="punct"><</span> <span class="constant">ArduinoSketch</span>
|
31
|
+
<span class="ident">vars</span> <span class="symbol">:a</span> <span class="punct">=></span> <span class="number">10</span><span class="punct">,</span> <span class="symbol">:b</span> <span class="punct">=></span> <span class="number">4</span>
|
32
|
+
<span class="ident">serial_begin</span>
|
33
|
+
|
34
|
+
<span class="keyword">def </span><span class="method">loop</span>
|
35
|
+
<span class="ident">serial_println</span> <span class="ident">product</span><span class="punct">(</span><span class="ident">a</span><span class="punct">,</span><span class="ident">b</span><span class="punct">)</span>
|
36
|
+
<span class="keyword">end</span>
|
37
|
+
|
38
|
+
<span class="ident">assembler</span><span class="punct">(</span> <span class="symbol">:product</span><span class="punct">,</span> <span class="punct">"</span><span class="string">int product(int a, int b);</span><span class="punct">",</span>
|
39
|
+
<span class="punct"><<-</span><span class="constant">CODE</span><span class="string">
|
40
|
+
product:
|
41
|
+
mov r18,r24 ; move a to another register
|
42
|
+
ldi r24,0 ; clear running sum, used to coalesce product
|
43
|
+
ldi r25,0 ; sum = 0
|
44
|
+
|
45
|
+
.loop:
|
46
|
+
tst r18 ; is a = 0? if so, we're done
|
47
|
+
breq .end
|
48
|
+
|
49
|
+
mov r19,r18 ; copy a
|
50
|
+
andi r19,1 ; is a % 2 == 0
|
51
|
+
breq .skip
|
52
|
+
|
53
|
+
add r24,r22 ; add b to sum
|
54
|
+
adc r25,r23
|
55
|
+
|
56
|
+
.skip:
|
57
|
+
lsr r18 ; divide a by 2
|
58
|
+
|
59
|
+
clc
|
60
|
+
rol r22 ; multiply b by 2
|
61
|
+
rol r23
|
62
|
+
rjmp .loop
|
63
|
+
|
64
|
+
.end:
|
65
|
+
ret
|
66
|
+
.size product, .-product
|
67
|
+
</span><span class="constant"> CODE</span>
|
68
|
+
<span class="punct">)</span>
|
69
|
+
<span class="keyword">end</span>
|
70
|
+
</pre>
|
71
|
+
</pre>
|
72
|
+
</body>
|
73
|
+
</html>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>gps_reader.rb.html</title
|
4
|
+
<style type="text/css">
|
5
|
+
|
6
|
+
.ruby .normal {}
|
7
|
+
.ruby .comment { color: #888; font-style: italic; }
|
8
|
+
.ruby .keyword { color: #A00; font-weight: bold; }
|
9
|
+
.ruby .method { color: #077; }
|
10
|
+
.ruby .class { color: #074; }
|
11
|
+
.ruby .module { color: #050; }
|
12
|
+
.ruby .punct { color: #447; font-weight: bold; }
|
13
|
+
.ruby .symbol { color: #099; }
|
14
|
+
.ruby .string { color: #944; }
|
15
|
+
.ruby .char { color: #F07; }
|
16
|
+
.ruby .ident { color: #004; }
|
17
|
+
.ruby .constant { color: #07F; }
|
18
|
+
.ruby .regex { color: #B66; }
|
19
|
+
.ruby .number { color: #D55; }
|
20
|
+
.ruby .attribute { color: #377; }
|
21
|
+
.ruby .global { color: #3B7; }
|
22
|
+
.ruby .expr { color: #227; }
|
23
|
+
</style>
|
24
|
+
</head>
|
25
|
+
<body>
|
26
|
+
<pre class="ruby">
|
27
|
+
<pre><span class="keyword">class </span><span class="class">GpsReader</span> <span class="punct"><</span> <span class="constant">ArduinoSketch</span>
|
28
|
+
<span class="ident">output_pin</span> <span class="number">13</span><span class="punct">,</span> <span class="symbol">:as</span> <span class="punct">=></span> <span class="symbol">:led</span>
|
29
|
+
<span class="ident">software_serial</span> <span class="number">6</span><span class="punct">,</span> <span class="number">7</span><span class="punct">,</span> <span class="symbol">:as</span> <span class="punct">=></span> <span class="symbol">:gps</span>
|
30
|
+
<span class="ident">serial_begin</span>
|
31
|
+
|
32
|
+
<span class="keyword">def </span><span class="method">loop</span>
|
33
|
+
<span class="ident">digitalWrite</span><span class="punct">(</span><span class="ident">led</span><span class="punct">,</span> <span class="constant">true</span><span class="punct">)</span>
|
34
|
+
<span class="ident">serial_print</span><span class="punct">(</span><span class="ident">gps</span><span class="punct">.</span><span class="ident">read</span><span class="punct">)</span>
|
35
|
+
<span class="keyword">end</span>
|
36
|
+
<span class="keyword">end</span></pre>
|
37
|
+
</pre>
|
38
|
+
</body>
|
39
|
+
</html>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>hello_world.rb.html</title
|
4
|
+
<style type="text/css">
|
5
|
+
|
6
|
+
.ruby .normal {}
|
7
|
+
.ruby .comment { color: #888; font-style: italic; }
|
8
|
+
.ruby .keyword { color: #A00; font-weight: bold; }
|
9
|
+
.ruby .method { color: #077; }
|
10
|
+
.ruby .class { color: #074; }
|
11
|
+
.ruby .module { color: #050; }
|
12
|
+
.ruby .punct { color: #447; font-weight: bold; }
|
13
|
+
.ruby .symbol { color: #099; }
|
14
|
+
.ruby .string { color: #944; }
|
15
|
+
.ruby .char { color: #F07; }
|
16
|
+
.ruby .ident { color: #004; }
|
17
|
+
.ruby .constant { color: #07F; }
|
18
|
+
.ruby .regex { color: #B66; }
|
19
|
+
.ruby .number { color: #D55; }
|
20
|
+
.ruby .attribute { color: #377; }
|
21
|
+
.ruby .global { color: #3B7; }
|
22
|
+
.ruby .expr { color: #227; }
|
23
|
+
</style>
|
24
|
+
</head>
|
25
|
+
<body>
|
26
|
+
<pre class="ruby">
|
27
|
+
<pre><span class="comment"># Hardware: LED connected on pin 7</span>
|
28
|
+
|
29
|
+
<span class="keyword">class </span><span class="class">HelloWorld</span> <span class="punct"><</span> <span class="constant">ArduinoSketch</span>
|
30
|
+
<span class="ident">output_pin</span> <span class="number">7</span><span class="punct">,</span> <span class="symbol">:as</span> <span class="punct">=></span> <span class="symbol">:led</span>
|
31
|
+
<span class="keyword">def </span><span class="method">loop</span>
|
32
|
+
<span class="ident">blink</span> <span class="ident">led</span><span class="punct">,</span> <span class="number">500</span>
|
33
|
+
<span class="keyword">end</span>
|
34
|
+
<span class="keyword">end</span>
|
35
|
+
</pre>
|
36
|
+
</pre>
|
37
|
+
</body>
|
38
|
+
</html>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>serial_motor.rb.html</title
|
4
|
+
<style type="text/css">
|
5
|
+
|
6
|
+
.ruby .normal {}
|
7
|
+
.ruby .comment { color: #888; font-style: italic; }
|
8
|
+
.ruby .keyword { color: #A00; font-weight: bold; }
|
9
|
+
.ruby .method { color: #077; }
|
10
|
+
.ruby .class { color: #074; }
|
11
|
+
.ruby .module { color: #050; }
|
12
|
+
.ruby .punct { color: #447; font-weight: bold; }
|
13
|
+
.ruby .symbol { color: #099; }
|
14
|
+
.ruby .string { color: #944; }
|
15
|
+
.ruby .char { color: #F07; }
|
16
|
+
.ruby .ident { color: #004; }
|
17
|
+
.ruby .constant { color: #07F; }
|
18
|
+
.ruby .regex { color: #B66; }
|
19
|
+
.ruby .number { color: #D55; }
|
20
|
+
.ruby .attribute { color: #377; }
|
21
|
+
.ruby .global { color: #3B7; }
|
22
|
+
.ruby .expr { color: #227; }
|
23
|
+
</style>
|
24
|
+
</head>
|
25
|
+
<body>
|
26
|
+
<pre class="ruby">
|
27
|
+
<pre><span class="comment"># Hardware: motor control circuit (i.e. TIP-120 control pin)</span>
|
28
|
+
<span class="comment"># connected at pin 7.</span>
|
29
|
+
<span class="comment"># Demo: http://www.youtube.com/watch?v=7OguEBfdTe0</span>
|
30
|
+
|
31
|
+
<span class="keyword">class </span><span class="class">SerialMotor</span> <span class="punct"><</span> <span class="constant">ArduinoSketch</span>
|
32
|
+
<span class="ident">output_pin</span> <span class="number">7</span><span class="punct">,</span> <span class="symbol">:as</span> <span class="punct">=></span> <span class="symbol">:motor</span>
|
33
|
+
<span class="ident">serial_begin</span>
|
34
|
+
|
35
|
+
<span class="keyword">def </span><span class="method">loop</span>
|
36
|
+
<span class="ident">digitalWrite</span><span class="punct">(</span><span class="ident">motor</span><span class="punct">,</span> <span class="ident">serial_read</span><span class="punct">)</span> <span class="keyword">if</span> <span class="ident">serial_available</span>
|
37
|
+
<span class="keyword">end</span>
|
38
|
+
<span class="keyword">end</span></pre>
|
39
|
+
</pre>
|
40
|
+
</body>
|
41
|
+
</html>
|
data/website/index.html
CHANGED
@@ -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.2.
|
36
|
+
<a href="http://rubyforge.org/projects/rad" class="numbers">0.2.1</a>
|
37
37
|
</div>
|
38
38
|
<h1>→ ‘Ruby Arduino Development’</h1>
|
39
39
|
|
@@ -62,7 +62,7 @@
|
|
62
62
|
<p><code>$ sudo gem install rad</code></p>
|
63
63
|
|
64
64
|
|
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>
|
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>
|
66
66
|
|
67
67
|
|
68
68
|
<h2>The Basics</h2>
|
@@ -101,10 +101,10 @@ end
|
|
101
101
|
</ul>
|
102
102
|
|
103
103
|
|
104
|
-
<h2>The Arduino <span class="caps">API</span></h2>
|
104
|
+
<h2>Documentation and The Arduino <span class="caps">API</span></h2>
|
105
105
|
|
106
106
|
|
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
|
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 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>
|
108
108
|
|
109
109
|
<h2>Demo: Serial Communication</h2>
|
110
110
|
<p>
|
@@ -115,6 +115,8 @@ end
|
|
115
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
116
|
</p>
|
117
117
|
<br style="clear:both" />
|
118
|
+
|
119
|
+
<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>
|
118
120
|
<h2><span class="caps">RAD</span> Needs You!</h2>
|
119
121
|
|
120
122
|
|
@@ -124,7 +126,7 @@ end
|
|
124
126
|
<p>There’s lots to do.</p>
|
125
127
|
|
126
128
|
|
127
|
-
<p>If you’re looking for a place to dive in and don’t know quite where, <a href="mailto:
|
129
|
+
<p>If you’re looking for a place to dive in and don’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 log at the code, the trunk repository is <code>svn://rubyforge.org/var/svn/rad/trunk</code> for anonymous access.</p>
|
128
130
|
|
129
131
|
|
130
132
|
<h2>License</h2>
|
@@ -136,7 +138,11 @@ end
|
|
136
138
|
<h2>Contact</h2>
|
137
139
|
|
138
140
|
|
139
|
-
<p>Comments, questions, heckles, attacks, praises, and, (most especially) patches and contributions are welcome! Send email to <a href="mailto:
|
141
|
+
<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>
|
142
|
+
|
143
|
+
<h2>Who</h2>
|
144
|
+
<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>
|
145
|
+
|
140
146
|
<p class="coda">
|
141
147
|
<a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>, 18th November 2007<br>
|
142
148
|
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rad
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Borenstein
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-04-
|
12
|
+
date: 2008-04-27 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -64,6 +64,10 @@ files:
|
|
64
64
|
- website/javascripts/rounded_corners_lite.inc.js
|
65
65
|
- website/stylesheets/screen.css
|
66
66
|
- website/template.rhtml
|
67
|
+
- website/examples/assembler_test.rb.html
|
68
|
+
- website/examples/gps_reader.rb.html
|
69
|
+
- website/examples/hello_world.rb.html
|
70
|
+
- website/examples/serial_motor.rb.html
|
67
71
|
has_rdoc: true
|
68
72
|
homepage: http://rad.rubyforge.org
|
69
73
|
post_install_message:
|