dbrady-switchy 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/switchy +13 -10
- metadata +2 -2
data/bin/switchy
CHANGED
@@ -25,6 +25,17 @@ s = Switchy.new
|
|
25
25
|
sleep 0.05
|
26
26
|
|
27
27
|
|
28
|
+
# lights by number => pair of pins, one to set high, the other low
|
29
|
+
# TODO: change these into on/off arrays so we can set multiple lights with a single command
|
30
|
+
# TODO: consider dropping this altogether and doing "switchy C4 1 C5 0" etc?
|
31
|
+
lights = {
|
32
|
+
0 => [nil, Switchy::PINS::D6 ],
|
33
|
+
1 => [Switchy::PINS::C4, Switchy::PINS::C5 ],
|
34
|
+
2 => [Switchy::PINS::B7, Switchy::PINS::B6 ],
|
35
|
+
3 => [Switchy::PINS::B5, Switchy::PINS::B4 ],
|
36
|
+
4 => [Switchy::PINS::B3, Switchy::PINS::B2 ],
|
37
|
+
}
|
38
|
+
|
28
39
|
until args.empty?
|
29
40
|
light = args.shift.to_i
|
30
41
|
command = args.shift.to_i
|
@@ -41,16 +52,8 @@ until args.empty?
|
|
41
52
|
|
42
53
|
raise "ERROR: status not yet implemented" if command == 'status'
|
43
54
|
|
44
|
-
lights
|
45
|
-
|
46
|
-
Switchy::PINS::C4,
|
47
|
-
Switchy::PINS::C5,
|
48
|
-
Switchy::PINS::C6,
|
49
|
-
Switchy::PINS::C7
|
50
|
-
]
|
51
|
-
|
52
|
-
s.set_pin lights[light], command
|
53
|
-
|
55
|
+
s.set_pin(lights[light][0], command) if lights[light][0]
|
56
|
+
s.set_pin(lights[light][1], 1-command) if lights[light][1]
|
54
57
|
end
|
55
58
|
|
56
59
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dbrady-switchy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Brady
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-04-
|
12
|
+
date: 2009-04-17 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|