madrona-rad 0.3.6 → 0.3.7
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/Manifest.txt +1 -0
- data/lib/plugins/basics.rb +54 -0
- data/lib/plugins/debounce.rb +18 -0
- data/lib/rad/arduino_sketch.rb +1 -1
- metadata +4 -16
data/Manifest.txt
CHANGED
@@ -0,0 +1,54 @@
|
|
1
|
+
class Basics < ArduinoPlugin
|
2
|
+
|
3
|
+
|
4
|
+
# RAD plugins are c methods, directives, external variables and assignments and calls
|
5
|
+
# that may be added to the main setup method
|
6
|
+
# function prototypes not needed since we generate them automatically
|
7
|
+
|
8
|
+
# directives, external variables and setup assignments and calls can be added rails style (not c style)
|
9
|
+
# hack from http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1209050315
|
10
|
+
|
11
|
+
# plugin_directives "#undef int", "#include <stdio.h>", "char _str[32];", "#define writeln(...) sprintf(_str, __VA_ARGS__); Serial.println(_str)"
|
12
|
+
# add to directives
|
13
|
+
#plugin_directives "#define EXAMPLE 10"
|
14
|
+
|
15
|
+
# add to external variables
|
16
|
+
# ok, we need to deal with
|
17
|
+
# what about variables
|
18
|
+
# need to loose the colon...
|
19
|
+
# external_variables "char status_message[40] = \"very cool\"", "char* msg[40]"
|
20
|
+
|
21
|
+
# add the following to the setup method
|
22
|
+
# add_to_setup "foo = 1";, "bar = 1;" "sub_setup();"
|
23
|
+
|
24
|
+
# one or more methods may be added and prototypes are generated automatically with rake make:upload
|
25
|
+
|
26
|
+
# call pulse(us) to pulse a servo
|
27
|
+
|
28
|
+
#####################
|
29
|
+
|
30
|
+
## basics.rb contains a set of simple methods such as on an off, enabling things like
|
31
|
+
# button.on or button.off
|
32
|
+
|
33
|
+
## abstract summary:
|
34
|
+
|
35
|
+
#
|
36
|
+
|
37
|
+
######################
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
void on(int pin)
|
42
|
+
{
|
43
|
+
digitalWrite( pin, HIGH );
|
44
|
+
}
|
45
|
+
|
46
|
+
void off(int pin)
|
47
|
+
{
|
48
|
+
digitalWrite( pin, LOW );
|
49
|
+
}
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
end
|
data/lib/plugins/debounce.rb
CHANGED
@@ -107,6 +107,24 @@ int read_input(int input)
|
|
107
107
|
}
|
108
108
|
|
109
109
|
|
110
|
+
int press(int input)
|
111
|
+
{
|
112
|
+
int state = LOW;
|
113
|
+
dbce[input].read = digitalRead(input);
|
114
|
+
|
115
|
+
if (dbce[input].read == HIGH && dbce[input].prev == LOW && millis() - dbce[input].time > dbce[input].adjust)
|
116
|
+
{
|
117
|
+
dbce[input].time = millis();
|
118
|
+
state = HIGH;
|
119
|
+
}
|
120
|
+
else
|
121
|
+
state = LOW;
|
122
|
+
|
123
|
+
dbce[input].prev = dbce[input].read;
|
124
|
+
return state;
|
125
|
+
}
|
126
|
+
|
127
|
+
|
110
128
|
int toggle(int input, int output)
|
111
129
|
{
|
112
130
|
return read_and_toggle(input, output);
|
data/lib/rad/arduino_sketch.rb
CHANGED
@@ -320,7 +320,7 @@ class ArduinoSketch
|
|
320
320
|
@debounce_pins << num
|
321
321
|
state = opts[:latch] == :on ? 1 : 0
|
322
322
|
prev = opts[:latch] == :on ? 0 : 1
|
323
|
-
adjust = opts[:adjust] ? opts[:adjust] :
|
323
|
+
adjust = opts[:adjust] ? opts[:adjust] : 20
|
324
324
|
@debounce_settings << "dbce[#{num}].state = #{state}, dbce[#{num}].read = 0, dbce[#{num}].prev = #{prev}, dbce[#{num}].time = 0, dbce[#{num}].adjust = #{adjust}"
|
325
325
|
end
|
326
326
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: madrona-rad
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Borenstein
|
@@ -31,7 +31,7 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 1.0.0.
|
34
|
+
version: 1.0.0.7
|
35
35
|
version:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: sexp_processor
|
@@ -46,19 +46,6 @@ dependencies:
|
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 3.0.2
|
48
48
|
version:
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: ParseTree
|
51
|
-
type: :runtime
|
52
|
-
version_requirement:
|
53
|
-
version_requirements: !ruby/object:Gem::Requirement
|
54
|
-
requirements:
|
55
|
-
- - ~>
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version: "3.0"
|
58
|
-
- - ">="
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: 3.0.4
|
61
|
-
version:
|
62
49
|
description: "Ruby Arduino Development: a framework for programming the Arduino physcial computing platform using Ruby"
|
63
50
|
email: jd@jdbarnhart.com
|
64
51
|
executables:
|
@@ -154,6 +141,7 @@ files:
|
|
154
141
|
- lib/libraries/Wire/twi.h
|
155
142
|
- lib/libraries/Wire/utility/twi.c
|
156
143
|
- lib/libraries/Wire/utility/twi.h
|
144
|
+
- lib/plugins/basics.rb
|
157
145
|
- lib/plugins/bitwise_ops.rb
|
158
146
|
- lib/plugins/blink.rb
|
159
147
|
- lib/plugins/blink_m.rb
|
@@ -241,6 +229,6 @@ rubyforge_project: rad
|
|
241
229
|
rubygems_version: 1.3.5
|
242
230
|
signing_key:
|
243
231
|
specification_version: 2
|
244
|
-
summary: "RAD: Ruby Arduino Development - 0.3.
|
232
|
+
summary: "RAD: Ruby Arduino Development - 0.3.7 -- 1.9 Ready"
|
245
233
|
test_files: []
|
246
234
|
|