madrona-rad 0.2.7 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -15
- data/Manifest.txt +38 -5
- data/README.rdoc +19 -7
- data/Rakefile +4 -3
- data/bin/rad +214 -130
- data/lib/examples/basic_blink.rb +10 -0
- data/lib/examples/blink_with_serial.rb +16 -0
- data/lib/examples/external_variable_fu.rb +21 -19
- data/lib/examples/external_variables.rb +0 -3
- data/lib/examples/hello_array2.rb +34 -1
- data/lib/examples/hello_array_eeprom.rb +4 -6
- data/lib/examples/hello_clock.rb +84 -0
- data/lib/examples/hello_eeprom.rb +3 -3
- data/lib/examples/hello_eeprom_lcdpa.rb +2 -2
- data/lib/examples/hello_format_print.rb +94 -0
- data/lib/examples/hello_spectra_sound.rb +38 -0
- data/lib/examples/hello_world.rb +3 -3
- data/lib/examples/hello_xbee.rb +12 -0
- data/lib/examples/midi_beat_box.rb +86 -0
- data/lib/examples/midi_scales.rb +94 -0
- data/lib/examples/servo_throttle.rb +11 -8
- data/lib/examples/software_serial.rb +10 -0
- data/lib/examples/twitter.rb +57 -0
- data/lib/libraries/AFSoftSerial/AFSoftSerial.cpp +321 -0
- data/lib/libraries/AFSoftSerial/AFSoftSerial.h +61 -0
- data/lib/libraries/{Servo → AFSoftSerial}/keywords.txt +18 -25
- data/lib/libraries/AF_XPort/AF_XPort.cpp +166 -0
- data/lib/libraries/AF_XPort/AF_XPort.h +48 -0
- data/lib/libraries/DS1307/DS1307.cpp +10 -9
- data/lib/libraries/DS1307/DS1307.h +6 -4
- data/lib/libraries/I2CEEPROM/I2CEEPROM.cpp +120 -0
- data/lib/libraries/I2CEEPROM/I2CEEPROM.h +70 -0
- data/lib/libraries/I2CEEPROM/keywords.txt +21 -0
- data/lib/libraries/LoopTimer/LoopTimer.cpp +35 -0
- data/lib/libraries/LoopTimer/LoopTimer.h +34 -0
- data/lib/libraries/LoopTimer/keywords.txt +27 -0
- data/lib/libraries/SWSerLCDpa/SWSerLCDpa.cpp +42 -48
- data/lib/libraries/SWSerLCDpa/SWSerLCDpa.h +11 -12
- data/lib/libraries/SWSerLCDsf/SWSerLCDsf.cpp +38 -0
- data/lib/libraries/SWSerLCDsf/SWSerLCDsf.h +9 -2
- data/lib/plugins/blink.rb +25 -0
- data/lib/plugins/blink_m.rb +3 -3
- data/lib/plugins/lcd_padding.rb +19 -0
- data/lib/plugins/midi.rb +60 -0
- data/lib/plugins/parallax_ping.rb +50 -0
- data/lib/plugins/servo_setup.rb +1 -1
- data/lib/plugins/twitter_connect.rb +145 -0
- data/lib/rad/README.rdoc +5 -0
- data/lib/rad/arduino_sketch.rb +91 -904
- data/lib/rad/darwin_installer.rb +23 -0
- data/lib/rad/generators/makefile/makefile.erb +1 -1
- data/lib/rad/generators/makefile/makefile.rb +3 -3
- data/lib/rad/hardware_library.rb +813 -0
- data/lib/rad/init.rb +4 -2
- data/lib/rad/linux_installer.rb +132 -0
- data/lib/rad/progressbar.rb +236 -0
- data/lib/rad/rad_processor.rb +56 -9
- data/lib/rad/rad_rewriter.rb +7 -2
- data/lib/rad/rad_type_checker.rb +1 -1
- data/lib/rad/sketch_compiler.rb +47 -0
- data/lib/rad/tasks/build_and_make.rake +41 -48
- data/lib/rad/version.rb +2 -2
- data/spec/examples/hello_world.rb +11 -0
- data/spec/examples/serial_motor.rb +12 -0
- data/spec/models/sketch_compiler_spec.rb +96 -0
- data/spec/sim/hello_world_spec.rb +0 -0
- data/test/hello_world_test/Makefile +436 -0
- data/test/hello_world_test/hello_world.cpp +23 -0
- data/test/test_array_processing.rb +1 -1
- data/test/test_plugin_loading.rb +1 -1
- data/test/test_translation_post_processing.rb +14 -70
- metadata +52 -39
- data/lib/examples/orig_servo_throttle.rb +0 -39
- data/lib/plugins/i2c_eeprom.rb +0 -70
@@ -0,0 +1,23 @@
|
|
1
|
+
#include <WProgram.h>
|
2
|
+
|
3
|
+
void loop();
|
4
|
+
void setup();
|
5
|
+
int main();
|
6
|
+
|
7
|
+
void setup() {
|
8
|
+
pinMode(13, OUTPUT);
|
9
|
+
}
|
10
|
+
|
11
|
+
int main() {
|
12
|
+
init();
|
13
|
+
setup();
|
14
|
+
for( ;; ) { loop(); }
|
15
|
+
return 0;
|
16
|
+
}
|
17
|
+
|
18
|
+
void loop() {
|
19
|
+
digitalWrite( 13, HIGH );
|
20
|
+
delay( 500 );
|
21
|
+
digitalWrite( 13, LOW );
|
22
|
+
delay( 500 );
|
23
|
+
}
|
data/test/test_plugin_loading.rb
CHANGED
@@ -14,66 +14,7 @@ require "#{File.expand_path(File.dirname(__FILE__))}/../lib/rad/variable_process
|
|
14
14
|
require "#{File.expand_path(File.dirname(__FILE__))}/../lib/rad/arduino_sketch"
|
15
15
|
require 'test/unit'
|
16
16
|
|
17
|
-
|
18
|
-
class TranslationTesting < ArduinoSketch
|
19
|
-
|
20
|
-
def one
|
21
|
-
delay 1
|
22
|
-
end
|
23
|
-
|
24
|
-
def two
|
25
|
-
delay 1
|
26
|
-
@foo = 1
|
27
|
-
end
|
28
|
-
|
29
|
-
def three
|
30
|
-
@foo = 1
|
31
|
-
bar = 2
|
32
|
-
baz = wha
|
33
|
-
end
|
34
|
-
|
35
|
-
def four
|
36
|
-
@foo = 1
|
37
|
-
bar = 2
|
38
|
-
wiggle = wha
|
39
|
-
end
|
40
|
-
|
41
|
-
def five
|
42
|
-
@foo = 1
|
43
|
-
f = KOOL
|
44
|
-
end
|
45
|
-
|
46
|
-
def six
|
47
|
-
a = ZAK
|
48
|
-
|
49
|
-
end
|
50
|
-
|
51
|
-
def seven(int)
|
52
|
-
# coerce int to long int
|
53
|
-
a = int * 2
|
54
|
-
end
|
55
|
-
|
56
|
-
def eight(str)
|
57
|
-
# coerce str to string
|
58
|
-
a = ZAK + str
|
59
|
-
end
|
60
|
-
|
61
|
-
def nine
|
62
|
-
@my_array.each do |a|
|
63
|
-
delay a
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
|
68
|
-
end
|
69
|
-
|
70
|
-
|
71
|
-
|
72
17
|
class TestTranslationPostProcessing < Test::Unit::TestCase
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
18
|
def setup
|
78
19
|
$external_var_identifiers = ["__foo", "__toggle", "wiggle"]
|
79
20
|
$define_types = { "KOOL" => "long", "ZAK" => "str"}
|
@@ -112,7 +53,7 @@ class TestTranslationPostProcessing < Test::Unit::TestCase
|
|
112
53
|
def test_trans_one
|
113
54
|
name = "foo_d"
|
114
55
|
expected = "void\none() {\ndelay(1);\n}"
|
115
|
-
result = raw_rtc_meth =
|
56
|
+
result = raw_rtc_meth = util_translate(:one)
|
116
57
|
assert_equal(expected, result)
|
117
58
|
end
|
118
59
|
|
@@ -120,7 +61,7 @@ class TestTranslationPostProcessing < Test::Unit::TestCase
|
|
120
61
|
def test_trans_two
|
121
62
|
name = "foo_e"
|
122
63
|
expected = "void\ntwo() {\ndelay(1);\n__foo = 1;\n}"
|
123
|
-
result = raw_rtc_meth =
|
64
|
+
result = raw_rtc_meth = util_translate(:two)
|
124
65
|
assert_equal(expected, result)
|
125
66
|
end
|
126
67
|
|
@@ -128,7 +69,7 @@ class TestTranslationPostProcessing < Test::Unit::TestCase
|
|
128
69
|
def test_trans_three
|
129
70
|
name = "foo_f"
|
130
71
|
expected = "void\nthree() {\nlong bar;\nvoid * baz;\n__foo = 1;\nbar = 2;\nbaz = wha();\n}"
|
131
|
-
result = raw_rtc_meth =
|
72
|
+
result = raw_rtc_meth = util_translate(:three)
|
132
73
|
assert_equal(expected, result)
|
133
74
|
end
|
134
75
|
|
@@ -137,49 +78,52 @@ class TestTranslationPostProcessing < Test::Unit::TestCase
|
|
137
78
|
def test_trans_four
|
138
79
|
name = "foo_f"
|
139
80
|
expected = "void\nfour() {\nlong bar;\nvoid * wiggle;\n__foo = 1;\nbar = 2;\nwiggle = wha();\n}"
|
140
|
-
result = raw_rtc_meth =
|
81
|
+
result = raw_rtc_meth = util_translate(:four)
|
141
82
|
assert_equal(expected, result)
|
142
83
|
end
|
143
84
|
|
144
85
|
def test_trans_five
|
145
86
|
name = "foo_f"
|
146
87
|
expected = "void\nfive() {\nlong f;\n__foo = 1;\nf = KOOL;\n}"
|
147
|
-
result = raw_rtc_meth =
|
88
|
+
result = raw_rtc_meth = util_translate(:five)
|
148
89
|
assert_equal(expected, result)
|
149
90
|
end
|
150
91
|
|
151
92
|
def test_trans_six
|
152
93
|
name = "foo_f"
|
153
94
|
expected = "void\nsix() {\nstr a;\na = ZAK;\n}"
|
154
|
-
result = raw_rtc_meth =
|
95
|
+
result = raw_rtc_meth = util_translate(:six)
|
155
96
|
assert_equal(expected, result)
|
156
97
|
end
|
157
98
|
|
158
99
|
def test_trans_seven
|
159
100
|
name = "foo_f"
|
160
101
|
expected = "void\nseven(long int) {\nlong a;\na = int * 2;\n}"
|
161
|
-
result = raw_rtc_meth =
|
102
|
+
result = raw_rtc_meth = util_translate(:seven)
|
162
103
|
assert_equal(expected, result)
|
163
104
|
end
|
164
105
|
|
165
106
|
def test_trans_eight
|
166
107
|
name = "foo_f"
|
167
108
|
expected = "void\neight(long str) {\nvoid * a;\na = ZAK + str;\n}"
|
168
|
-
result = raw_rtc_meth =
|
109
|
+
result = raw_rtc_meth = util_translate(:eight)
|
169
110
|
assert_equal(expected, result)
|
170
111
|
end
|
171
112
|
|
172
113
|
def test_trans_nine
|
173
114
|
name = "foo_f"
|
174
115
|
expected = "void\nnine() {\nunsigned int index_a;\nfor (index_a = 0; index_a < (int) (sizeof(__my_array) / sizeof(__my_array[0])); index_a++) {\nint a = __my_array[index_a];\ndelay(a);\n}\n}"
|
175
|
-
result = raw_rtc_meth =
|
116
|
+
result = raw_rtc_meth = util_translate(:nine)
|
176
117
|
assert_equal(expected, result)
|
177
118
|
end
|
178
|
-
|
119
|
+
|
120
|
+
def util_translate meth
|
121
|
+
RADProcessor.translate("test/fixture.rb", :TranslationTesting, meth)
|
122
|
+
end
|
179
123
|
|
180
124
|
## need to look at unsigned long
|
181
125
|
## need parens removal tests
|
182
126
|
|
183
127
|
|
184
128
|
|
185
|
-
end
|
129
|
+
end
|
metadata
CHANGED
@@ -1,37 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: madrona-rad
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Borenstein
|
8
|
-
- JD Barnhart
|
8
|
+
- "plugins+: JD Barnhart"
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2008-
|
13
|
+
date: 2008-08-18 00:00:00 -07:00
|
14
14
|
default_executable: rad
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
|
-
name:
|
17
|
+
name: mime-types
|
18
|
+
type: :runtime
|
18
19
|
version_requirement:
|
19
20
|
version_requirements: !ruby/object:Gem::Requirement
|
20
21
|
requirements:
|
21
|
-
- - "
|
22
|
+
- - ">"
|
22
23
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
24
|
+
version: 0.0.0
|
24
25
|
version:
|
25
|
-
|
26
|
-
name: hoe
|
27
|
-
version_requirement:
|
28
|
-
version_requirements: !ruby/object:Gem::Requirement
|
29
|
-
requirements:
|
30
|
-
- - ">="
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 1.7.0
|
33
|
-
version:
|
34
|
-
description: 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. 0.2.7.0.1
|
26
|
+
description: "Ruby Arduino Development: a framework for programming the Arduino physcial computing platform using Ruby"
|
35
27
|
email: jd@jdbarnhart.com
|
36
28
|
executables:
|
37
29
|
- rad
|
@@ -39,29 +31,23 @@ extensions: []
|
|
39
31
|
|
40
32
|
extra_rdoc_files:
|
41
33
|
- History.txt
|
42
|
-
- License.txt
|
43
34
|
- Manifest.txt
|
44
|
-
- lib/libraries/DS1307/keywords.txt
|
45
|
-
- lib/libraries/FrequencyTimer2/keywords.txt
|
46
|
-
- lib/libraries/OneWire/keywords.txt
|
47
|
-
- lib/libraries/OneWire/readme.txt
|
48
|
-
- lib/libraries/Servo/keywords.txt
|
49
|
-
- lib/libraries/Stepper/keywords.txt
|
50
|
-
- lib/libraries/Wire/keywords.txt
|
51
|
-
- lib/rad/todo.txt
|
52
35
|
- README.rdoc
|
53
|
-
- website/index.txt
|
54
36
|
files:
|
55
37
|
- History.txt
|
56
38
|
- License.txt
|
57
39
|
- Manifest.txt
|
58
40
|
- README.rdoc
|
59
41
|
- Rakefile
|
42
|
+
- test/hello_world_test/Makefile
|
43
|
+
- test/hello_world_test/hello_world.cpp
|
60
44
|
- bin/rad
|
61
45
|
- lib/examples/add_hysteresis.rb
|
46
|
+
- lib/examples/basic_blink.rb
|
62
47
|
- lib/examples/blink_m_address_assignment.rb
|
63
48
|
- lib/examples/blink_m_hello.rb
|
64
49
|
- lib/examples/blink_m_multi.rb
|
50
|
+
- lib/examples/blink_with_serial.rb
|
65
51
|
- lib/examples/configure_pa_lcd_boot.rb
|
66
52
|
- lib/examples/debounce_methods.rb
|
67
53
|
- lib/examples/external_variable_fu.rb
|
@@ -71,30 +57,48 @@ files:
|
|
71
57
|
- lib/examples/hello_array.rb
|
72
58
|
- lib/examples/hello_array2.rb
|
73
59
|
- lib/examples/hello_array_eeprom.rb
|
60
|
+
- lib/examples/hello_clock.rb
|
74
61
|
- lib/examples/hello_eeprom.rb
|
75
62
|
- lib/examples/hello_eeprom_lcdpa.rb
|
63
|
+
- lib/examples/hello_format_print.rb
|
76
64
|
- lib/examples/hello_lcd_charset.rb
|
77
65
|
- lib/examples/hello_pa_lcd.rb
|
78
66
|
- lib/examples/hello_servos.rb
|
67
|
+
- lib/examples/hello_spectra_sound.rb
|
79
68
|
- lib/examples/hello_world.rb
|
69
|
+
- lib/examples/hello_xbee.rb
|
80
70
|
- lib/examples/hysteresis_duel.rb
|
81
71
|
- lib/examples/i2c_with_clock_chip.rb
|
72
|
+
- lib/examples/midi_beat_box.rb
|
73
|
+
- lib/examples/midi_scales.rb
|
82
74
|
- lib/examples/motor_knob.rb
|
83
|
-
- lib/examples/orig_servo_throttle.rb
|
84
75
|
- lib/examples/servo_buttons.rb
|
85
76
|
- lib/examples/servo_calibrate_continuous.rb
|
86
77
|
- lib/examples/servo_throttle.rb
|
78
|
+
- lib/examples/software_serial.rb
|
87
79
|
- lib/examples/sparkfun_lcd.rb
|
88
80
|
- lib/examples/spectra_soft_pot.rb
|
89
81
|
- lib/examples/times_method.rb
|
90
82
|
- lib/examples/toggle.rb
|
83
|
+
- lib/examples/twitter.rb
|
91
84
|
- lib/examples/two_wire.rb
|
85
|
+
- lib/libraries/AFSoftSerial/AFSoftSerial.cpp
|
86
|
+
- lib/libraries/AFSoftSerial/AFSoftSerial.h
|
87
|
+
- lib/libraries/AFSoftSerial/keywords.txt
|
88
|
+
- lib/libraries/AF_XPort/AF_XPort.cpp
|
89
|
+
- lib/libraries/AF_XPort/AF_XPort.h
|
92
90
|
- lib/libraries/DS1307/DS1307.cpp
|
93
91
|
- lib/libraries/DS1307/DS1307.h
|
94
92
|
- lib/libraries/DS1307/keywords.txt
|
95
93
|
- lib/libraries/FrequencyTimer2/FrequencyTimer2.cpp
|
96
94
|
- lib/libraries/FrequencyTimer2/FrequencyTimer2.h
|
97
95
|
- lib/libraries/FrequencyTimer2/keywords.txt
|
96
|
+
- lib/libraries/I2CEEPROM/I2CEEPROM.cpp
|
97
|
+
- lib/libraries/I2CEEPROM/I2CEEPROM.h
|
98
|
+
- lib/libraries/I2CEEPROM/keywords.txt
|
99
|
+
- lib/libraries/LoopTimer/LoopTimer.cpp
|
100
|
+
- lib/libraries/LoopTimer/LoopTimer.h
|
101
|
+
- lib/libraries/LoopTimer/keywords.txt
|
98
102
|
- lib/libraries/OneWire/OneWire.cpp
|
99
103
|
- lib/libraries/OneWire/OneWire.h
|
100
104
|
- lib/libraries/OneWire/keywords.txt
|
@@ -105,7 +109,6 @@ files:
|
|
105
109
|
- lib/libraries/SWSerLCDsf/SWSerLCDsf.h
|
106
110
|
- lib/libraries/Servo/Servo.cpp
|
107
111
|
- lib/libraries/Servo/Servo.h
|
108
|
-
- lib/libraries/Servo/keywords.txt
|
109
112
|
- lib/libraries/Stepper/Stepper.cpp
|
110
113
|
- lib/libraries/Stepper/Stepper.h
|
111
114
|
- lib/libraries/Stepper/keywords.txt
|
@@ -116,39 +119,51 @@ files:
|
|
116
119
|
- lib/libraries/Wire/utility/twi.c
|
117
120
|
- lib/libraries/Wire/utility/twi.h
|
118
121
|
- lib/plugins/bitwise_ops.rb
|
122
|
+
- lib/plugins/blink.rb
|
119
123
|
- lib/plugins/blink_m.rb
|
120
124
|
- lib/plugins/debounce.rb
|
121
125
|
- lib/plugins/debug_output_to_lcd.rb
|
122
126
|
- lib/plugins/hysteresis.rb
|
123
|
-
- lib/plugins/i2c_eeprom.rb
|
124
127
|
- lib/plugins/input_output_state.rb
|
125
128
|
- lib/plugins/lcd_padding.rb
|
126
129
|
- lib/plugins/mem_test.rb
|
130
|
+
- lib/plugins/midi.rb
|
131
|
+
- lib/plugins/parallax_ping.rb
|
127
132
|
- lib/plugins/servo_pulse.rb
|
128
133
|
- lib/plugins/servo_setup.rb
|
129
134
|
- lib/plugins/smoother.rb
|
130
135
|
- lib/plugins/spark_fun_serial_lcd.rb
|
131
136
|
- lib/plugins/spectra_symbol.rb
|
137
|
+
- lib/plugins/twitter_connect.rb
|
132
138
|
- lib/rad.rb
|
139
|
+
- lib/rad/README.rdoc
|
133
140
|
- lib/rad/arduino_plugin.rb
|
134
141
|
- lib/rad/arduino_sketch.rb
|
135
142
|
- lib/rad/generators/makefile/makefile.erb
|
136
143
|
- lib/rad/generators/makefile/makefile.rb
|
144
|
+
- lib/rad/hardware_library.rb
|
137
145
|
- lib/rad/init.rb
|
146
|
+
- lib/rad/progressbar.rb
|
138
147
|
- lib/rad/rad_processor.rb
|
148
|
+
- lib/rad/linux_installer.rb
|
149
|
+
- lib/rad/darwin_installer.rb
|
139
150
|
- lib/rad/rad_rewriter.rb
|
140
151
|
- lib/rad/rad_type_checker.rb
|
141
152
|
- lib/rad/sim/arduino_sketch.rb
|
153
|
+
- lib/rad/sketch_compiler.rb
|
142
154
|
- lib/rad/tasks/build_and_make.rake
|
143
|
-
- lib/rad/developer.rake
|
144
155
|
- lib/rad/tasks/rad.rb
|
145
156
|
- lib/rad/todo.txt
|
146
157
|
- lib/rad/variable_processing.rb
|
147
158
|
- lib/rad/version.rb
|
148
159
|
- scripts/txt2html
|
149
160
|
- setup.rb
|
150
|
-
- spec/
|
161
|
+
- spec/examples/hello_world.rb
|
162
|
+
- spec/examples/serial_motor.rb
|
151
163
|
- spec/models/arduino_sketch_spec.rb
|
164
|
+
- spec/models/sketch_compiler_spec.rb
|
165
|
+
- spec/models/spec_helper.rb
|
166
|
+
- spec/sim/hello_world_spec.rb
|
152
167
|
- spec/spec.opts
|
153
168
|
- test/test_array_processing.rb
|
154
169
|
- test/test_plugin_loading.rb
|
@@ -164,7 +179,8 @@ files:
|
|
164
179
|
- website/examples/hello_world.rb.html
|
165
180
|
- website/examples/serial_motor.rb.html
|
166
181
|
has_rdoc: true
|
167
|
-
homepage: http://rad
|
182
|
+
homepage: http://github.com/atduskreg/rad
|
183
|
+
licenses:
|
168
184
|
post_install_message:
|
169
185
|
rdoc_options:
|
170
186
|
- --main
|
@@ -186,12 +202,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
202
|
requirements: []
|
187
203
|
|
188
204
|
rubyforge_project: rad
|
189
|
-
rubygems_version: 1.
|
205
|
+
rubygems_version: 1.3.5
|
190
206
|
signing_key:
|
191
207
|
specification_version: 2
|
192
|
-
summary:
|
193
|
-
test_files:
|
194
|
-
|
195
|
-
- test/test_plugin_loading.rb
|
196
|
-
- test/test_translation_post_processing.rb
|
197
|
-
- test/test_variable_processing.rb
|
208
|
+
summary: "RAD: Ruby Arduino Development - 0.3.1 - 0.3"
|
209
|
+
test_files: []
|
210
|
+
|
@@ -1,39 +0,0 @@
|
|
1
|
-
class OrigServoThrottle < ArduinoSketch
|
2
|
-
|
3
|
-
# old school servo control
|
4
|
-
# uses pulsewidth for positioning
|
5
|
-
# potentiometer to control servo
|
6
|
-
# with a bit of hysteresis
|
7
|
-
# use analog pin for sensor
|
8
|
-
# need to format the output of sensor_position and sensor_amount
|
9
|
-
# probably going away soon
|
10
|
-
|
11
|
-
|
12
|
-
external_vars :sensor_position => "int, 0", :servo_amount => "int, 0", :pw => "int, 0", :time_check => "unsigned long, 0"
|
13
|
-
|
14
|
-
output_pin 5, :as => :my_lcd, :device => :sf_lcd
|
15
|
-
input_pin 1, :as => :sensor
|
16
|
-
output_pin 2, :as => :my_servo, :min => 700, :max => 2200 #, :refresh => 60
|
17
|
-
|
18
|
-
|
19
|
-
def loop
|
20
|
-
#delay 9 # comment out if using servo status, since it will add enough delay
|
21
|
-
sensor_position = analogRead(sensor)
|
22
|
-
servo_amount = (add_hysteresis(sensor_position, 10)*2 + 500)
|
23
|
-
move_servo my_servo, servo_amount
|
24
|
-
servo_status
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
def servo_status
|
29
|
-
|
30
|
-
my_lcd.setxy 0,0 # line 0, col 0
|
31
|
-
my_lcd.print "Read Send"
|
32
|
-
my_lcd.setxy 0,1 # line 1, col 0
|
33
|
-
my_lcd.print sensor_position # need method of blanking out previous reading
|
34
|
-
my_lcd.setxy 6,1
|
35
|
-
my_lcd.print servo_amount
|
36
|
-
end
|
37
|
-
|
38
|
-
|
39
|
-
end
|