rpi_led_simulator 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/rpi_led_simulator.rb +6 -61
- data.tar.gz.sig +2 -3
- metadata +39 -19
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62443ea7153d99f30959e15842f301bfe9818ced
|
4
|
+
data.tar.gz: 0024464c188bc773b0085eb5444d0a8a980ecf5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e15bbb067956aad6c2b2c848cab3179240e7029d59add267dfdf7c342e1a8f3f46b44d811f0cf4e596a9a061705cbc4ae9256a63302afbe567c0acaf0104d8b1
|
7
|
+
data.tar.gz: 4d71b5ebd29ef517298466712aa4b8bbf63198474b6cfafad0abdfdfb8ab91cfa4003e747272cdfa8976363c56acbf9583ad51bceaa99b09ad013c5e04948f0b
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/rpi_led_simulator.rb
CHANGED
@@ -2,19 +2,19 @@
|
|
2
2
|
|
3
3
|
# file: rpi_led_simulator.rb
|
4
4
|
|
5
|
+
require 'pinx'
|
5
6
|
require 'colored'
|
6
7
|
|
7
8
|
class RPiLedSimulator
|
8
9
|
|
9
10
|
@leds = []
|
10
11
|
|
11
|
-
class PinX
|
12
|
+
class Led < PinX
|
12
13
|
|
13
|
-
attr_reader :id
|
14
14
|
|
15
15
|
def initialize(id, color: :red, parent: nil)
|
16
|
-
|
17
|
-
|
16
|
+
|
17
|
+
super(id)
|
18
18
|
@color = color
|
19
19
|
@parent = parent
|
20
20
|
|
@@ -23,62 +23,7 @@ class RPiLedSimulator
|
|
23
23
|
def color()
|
24
24
|
@on ? @color : :black
|
25
25
|
end
|
26
|
-
|
27
|
-
def on(durationx=nil, duration: nil)
|
28
|
-
|
29
|
-
@on, @blinking = true, false
|
30
|
-
duration ||= durationx
|
31
|
-
|
32
|
-
@off_thread.exit if @off_thread
|
33
|
-
@on_thread = Thread.new {(sleep duration; off()) } if duration
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
def off(durationx=nil, duration: nil)
|
38
|
-
|
39
|
-
@on, @blinking = false, false
|
40
|
-
duration ||= durationx
|
41
|
-
|
42
|
-
@on_thread.exit if @on_thread
|
43
|
-
@off_thread = Thread.new { (sleep duration; on()) } if duration
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
|
48
|
-
alias stop off
|
49
|
-
|
50
|
-
def blink(seconds=0.5, duration: nil)
|
51
|
-
|
52
|
-
@blinking = true
|
53
|
-
t2 = Time.now + duration if duration
|
54
|
-
|
55
|
-
Thread.new do
|
56
|
-
while @blinking do
|
57
|
-
|
58
|
-
@on = true
|
59
|
-
sleep seconds / 2.0
|
60
|
-
break if !@blinking
|
61
|
-
sleep seconds / 2.0
|
62
|
-
break if !@blinking
|
63
|
-
|
64
|
-
@on = false
|
65
|
-
sleep seconds / 2.0
|
66
|
-
break if !@blinking
|
67
|
-
sleep seconds / 2.0
|
68
|
-
break if !@blinking
|
69
|
-
|
70
|
-
@on = false; @blinking = false if duration and Time.now >= t2
|
71
|
-
end
|
72
26
|
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def on?() @on end
|
77
|
-
def off?() !@on end
|
78
|
-
|
79
|
-
def to_s()
|
80
|
-
@id
|
81
|
-
end
|
82
27
|
end
|
83
28
|
|
84
29
|
class Void
|
@@ -105,7 +50,7 @@ class RPiLedSimulator
|
|
105
50
|
|
106
51
|
@pins = a.map.with_index do |pin, i|
|
107
52
|
|
108
|
-
|
53
|
+
Led.new pin, color: colors[i] || color, parent: self
|
109
54
|
|
110
55
|
end
|
111
56
|
|
@@ -156,4 +101,4 @@ class RPiLedSimulator
|
|
156
101
|
puts
|
157
102
|
end
|
158
103
|
|
159
|
-
end
|
104
|
+
end
|
data.tar.gz.sig
CHANGED
@@ -1,3 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
��F�5����,�=�1���@��
|
1
|
+
���v�#�Ab�`n��^��qTY���=��!d�C8�Z���-����R���W��L_��;� ��x^��÷�8F�8\�e���;�}¼B����g�u��-S��;^%�$�ɥ{��V9���Xٜ�/�-�7�K���;(�ɺ�;����ʼn�t�~��Bo_��neV�"v�@$&�_��uy���~,q0�涪�j8G�u��/��϶�>�}���^Q'��d�v�3U�ҳӗ���
|
2
|
+
W�]0-�����4~�sC,t
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rpi_led_simulator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -12,27 +12,47 @@ cert_chain:
|
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
|
14
14
|
YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
|
15
|
-
|
15
|
+
8ixkARkWAmV1MB4XDTE3MDUwOTIyMTgwNloXDTE4MDUwOTIyMTgwNlowSDESMBAG
|
16
16
|
A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
|
17
17
|
EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
18
|
+
ggEBANM88J6GBNHqu2JgvgNugGswK95FlyhpEDtaJXjNjWtBWgSZKy7wMcstziEJ
|
19
|
+
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
-
date:
|
34
|
+
date: 2017-05-09 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: pinx
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0.1'
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.1.0
|
46
|
+
type: :runtime
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0.1'
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.1.0
|
36
56
|
- !ruby/object:Gem::Dependency
|
37
57
|
name: colored
|
38
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -54,7 +74,7 @@ dependencies:
|
|
54
74
|
- !ruby/object:Gem::Version
|
55
75
|
version: '1.2'
|
56
76
|
description:
|
57
|
-
email: james@
|
77
|
+
email: james@jamesrobertson.eu
|
58
78
|
executables: []
|
59
79
|
extensions: []
|
60
80
|
extra_rdoc_files: []
|
@@ -80,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
100
|
version: '0'
|
81
101
|
requirements: []
|
82
102
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.
|
103
|
+
rubygems_version: 2.6.8
|
84
104
|
signing_key:
|
85
105
|
specification_version: 4
|
86
106
|
summary: Simulates the rpi gem's functionality for controlling LEDs.
|
metadata.gz.sig
CHANGED
Binary file
|