time7segment 0.2.0 → 0.2.1
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/time7segment.rb +15 -4
- data.tar.gz.sig +0 -0
- metadata +2 -2
- 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: 20f46b6ad4b8060dfab2cccbc2ea31a715b73281
|
4
|
+
data.tar.gz: 07536329ac334a8f63a6bc9b9801dbb747ee855f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b07fe033fb0f728a0ecf5dd47eb03fe8915f0a30736a4d3cbabfd4e248416519883322854536bf28dee8b463cacb3e94e4e3fec2743ef722e93a3bec1a5151a0
|
7
|
+
data.tar.gz: 8941dd5a3366f61ad88d8fb016840e37d4ed49a26934305d4b6dd8e87d7a1462a16c27bb17b22e0e164b580dde3beb7f97c176919d9434b13b680ab4d44e662d
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/time7segment.rb
CHANGED
@@ -28,7 +28,7 @@ require 'simple_raspberrypi'
|
|
28
28
|
class Time7Segment
|
29
29
|
|
30
30
|
# d1 d2 d3 d4 a b c d e f g dp
|
31
|
-
def initialize(gpio=%w(22 27 17 24 11 4 23 8 20 10 18 25), refresh: 0.
|
31
|
+
def initialize(gpio=%w(22 27 17 24 11 4 23 8 20 10 18 25), refresh: 0.005)
|
32
32
|
|
33
33
|
pins = SimpleRaspberryPi.new(gpio).pins
|
34
34
|
@digits, @segments, @refresh = pins.take(4), pins.slice(4..-1), refresh
|
@@ -46,9 +46,21 @@ class Time7Segment
|
|
46
46
|
loop do
|
47
47
|
|
48
48
|
Time.now.strftime("%H%M").chars.each.with_index do |x,i|
|
49
|
+
|
50
|
+
n = x.to_i
|
51
|
+
display(n); @segments[7].method( i == 1 ? :off : :on).call
|
52
|
+
@digits[i].on
|
49
53
|
|
50
|
-
|
51
|
-
|
54
|
+
refresh = @refresh
|
55
|
+
|
56
|
+
# reduce the sleep time for digit 1 since it takes less time to
|
57
|
+
# update the segments. This gives a more balanced brightness display,
|
58
|
+
# especially for digits 0 and 8
|
59
|
+
|
60
|
+
refresh -= refresh / 2 if n == 1
|
61
|
+
sleep refresh
|
62
|
+
|
63
|
+
@digits[i].off
|
52
64
|
|
53
65
|
end
|
54
66
|
|
@@ -70,4 +82,3 @@ end
|
|
70
82
|
|
71
83
|
if __FILE__ == $0 then
|
72
84
|
Time7Segment.new(*ARGV).start
|
73
|
-
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: time7segment
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
+hK+FacNWYYl7NLDoAQDnx8UxWfUl7WpWi7B/U09XsOHNwhaTJsZ6GeVkdVm1E//
|
32
32
|
W1B8FmCNgggaYQ==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2016-04-
|
34
|
+
date: 2016-04-10 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: simple_raspberrypi
|
metadata.gz.sig
CHANGED
Binary file
|