domotics-arduino 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,33 +1,30 @@
|
|
1
|
-
|
2
|
-
module
|
3
|
-
module Arduino
|
4
|
-
module DigitalPin
|
1
|
+
module Domotics::Arduino
|
2
|
+
module DigitalPin
|
5
3
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
4
|
+
def initialize(args = {})
|
5
|
+
@board = Domotics::Device[args[:device]]
|
6
|
+
@pin = args[:pin]
|
7
|
+
@board.register_pin self, @pin
|
8
|
+
super
|
9
|
+
end
|
12
10
|
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
def state!
|
12
|
+
to_hls @board.get_digital(@pin)
|
13
|
+
end
|
16
14
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
def set_state(value)
|
16
|
+
@board.set_digital @pin, to_lls(value)
|
17
|
+
super
|
18
|
+
end
|
21
19
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
20
|
+
# Convert to High Level State
|
21
|
+
def to_hls(value)
|
22
|
+
value == ArduinoBase::HIGH ? :on : :off
|
23
|
+
end
|
26
24
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
end
|
25
|
+
# Convert to Low Level State
|
26
|
+
def to_lls(value)
|
27
|
+
value == :on ? ArduinoBase::HIGH : ArduinoBase::LOW
|
31
28
|
end
|
32
29
|
end
|
33
30
|
end
|
@@ -1,15 +1,11 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
module
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
super
|
10
|
-
@board.set_input_pullup @pin
|
11
|
-
@board.set_watch @pin, ArduinoBase::WATCHON
|
12
|
-
end
|
1
|
+
module Domotics::Arduino
|
2
|
+
# Normal_close sensor
|
3
|
+
module NCSensor
|
4
|
+
include DigitalPin
|
5
|
+
def initialize(args = {})
|
6
|
+
super
|
7
|
+
@board.set_input_pullup @pin
|
8
|
+
@board.set_watch @pin, ArduinoBase::WATCHON
|
13
9
|
end
|
14
10
|
end
|
15
11
|
end
|
@@ -1,12 +1,9 @@
|
|
1
|
-
module Domotics
|
2
|
-
module
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
super
|
8
|
-
@board.set_watch @pin, ArduinoBase::WATCHON
|
9
|
-
end
|
1
|
+
module Domotics::Arduino
|
2
|
+
module NOSensor
|
3
|
+
include DigitalPin
|
4
|
+
def initialize(args = {})
|
5
|
+
super
|
6
|
+
@board.set_watch @pin, ArduinoBase::WATCHON
|
10
7
|
end
|
11
8
|
end
|
12
9
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: domotics-arduino
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-01-
|
12
|
+
date: 2014-01-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: serialport
|