rpi_led_bargraph 0.1.0

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: daee57871dc6a4e5e45a256f2d9205d84e0e45b3
4
+ data.tar.gz: fcaf8a25dd0effb9936698d706f01ebd23095019
5
+ SHA512:
6
+ metadata.gz: 255dcca94e857f77e56cc235e628b9cbea0cb986edc87fcd749aed3415837a19611c494cc0ebcce0898e517ce165d7a3cbf655eb4070651469f848e0f718a060
7
+ data.tar.gz: d080fe99c150ebe2c74dd90d909f180a490dda1f6f50f412892dbfda451e6bfcf78c1d18a2cb38cc2ee1611d8c94accb46bd4fd461d94c097d35c342968f92bc
checksums.yaml.gz.sig ADDED
Binary file
data.tar.gz.sig ADDED
Binary file
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: rpi_led_bargraph.rb
4
+
5
+ require 'rpi'
6
+
7
+
8
+ class RPiLedBarGraph < RPi
9
+
10
+ def initialize(pins, wait: 0.1, dir: :ltr, invert: false)
11
+ super pins
12
+ @wait, @dir, @invert = wait, dir, invert
13
+ end
14
+
15
+ def on
16
+ a = @dir == :ltr ? pins : pins.reverse
17
+ a.each {|x| x.on; sleep @wait}
18
+ :on
19
+ end
20
+
21
+ def off
22
+ a = @dir == :ltr ? pins.reverse : pins
23
+ a.each {|x| x.off; sleep @wait}
24
+ :off
25
+ end
26
+
27
+ def inspect()
28
+ 'done'
29
+ end
30
+
31
+ # input % from 0-100
32
+ #
33
+ def level(n, state=nil, blink: false)
34
+
35
+ blink = state if state == :blink
36
+
37
+ upper = pins.length / (100.0 / n) - 1
38
+ upper = pins.length - upper - 1 if @invert
39
+
40
+ a = @dir == :ltr ? pins : pins.reverse
41
+ a.each(&:off)
42
+ sleep 0.3 if blink
43
+ a[0..(upper).to_i].each(&:on)
44
+
45
+ a[upper].blink if blink
46
+
47
+ end
48
+
49
+ alias progress level
50
+
51
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rpi_led_bargraph
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
+ YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
+ 8ixkARkWAmV1MB4XDTE2MDIyODIxMDAwMVoXDTE3MDIyNzIxMDAwMVowSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
+ ggEBAKofpDyayxyfgErMdvZu+M1fD1q4HjCctH4ihzA4zzEkTyGV0aMWvnhbJ6fl
19
+ k3lY5SlC72ZOf/bW1kVffd7BVxpWCuBeo7xg1BoMezaqn6PP1Hnn0EhT/qNPC/ZJ
20
+ IGV8BcZLFLUTKpiaaUMPD2OmwvcotzdwWzpOpBq/Td0yxLShcMEQgx2eXI57O/5s
21
+ iZEgAvWP+e8H0V9/YiOgCnDbt5zsCXgPT2eNFdxcnwxULcUnvx7QgGM8FYVH9V+P
22
+ 9BPJMjglt2l/iT61gOPRO9ZsKaSKHLO/wuwxWalZQtLV5qFiUCKbw3riyltozx+F
23
+ h8Fo+vaxsncXKcT0ib8tInr7VyECAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
+ DwQEAwIEsDAdBgNVHQ4EFgQUIEecHBjhAuuJzoeCe4g/sJE+0R0wJgYDVR0RBB8w
25
+ HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAi+dF2Bek
27
+ g9TjApDrJHrnxPTPogEKCPYCUKCSXl53ZP17SdskUzu/dLIAs/3ifFVQFC/QcyuC
28
+ AiXEqsbxhg6knYBrkmQfcbpZ+vnWZ8EFyUXkvGMru3f0VKWzRFiyzua8xKC/WBmv
29
+ HrH3xG0D3TwUOhiT5i2lIWbwsKKo3dND0gkgnh0Lfj0mGCg5axkMEJOLmEkl9KRt
30
+ oI9KmivpsTlNnGPzHnLIjyvs+vbjAofTqiQhqkwj082gPYpYxRwZ8n8ko8PpyMRr
31
+ 4ry38pQMrbNookqpiCpOBwQKZxzlSEt5e4L6yn9WL5PIPG9MDUnTNI7QU9vTJQIR
32
+ VPsfAKArOaooXw==
33
+ -----END CERTIFICATE-----
34
+ date: 2016-02-28 00:00:00.000000000 Z
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: rpi
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '0.4'
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 0.4.7
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '0.4'
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 0.4.7
56
+ description:
57
+ email: james@r0bertson.co.uk
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - lib/rpi_led_bargraph.rb
63
+ homepage: https://github.com/jrobertson/rpi_led_bargraph
64
+ licenses:
65
+ - MIT
66
+ metadata: {}
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ requirements: []
82
+ rubyforge_project:
83
+ rubygems_version: 2.4.8
84
+ signing_key:
85
+ specification_version: 4
86
+ summary: Controls an LED bar graph using a Raspberry Pi
87
+ test_files: []
metadata.gz.sig ADDED
Binary file