humble_rpi-plugin-led 0.1.1

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: cd50a57b33ad73c94f4ba586d69b9de924ca768d
4
+ data.tar.gz: 380f427a63fbf938a164deb40922caede7e48d30
5
+ SHA512:
6
+ metadata.gz: 50e07ebf88cf986522b0cc2eb8a0188f9e2aa4d52bc185c9bb443a09492bde86835a01ca28f5b49d0d4c908e27598a37731b9e7b0e19f98a7cb3f824eaaa510f
7
+ data.tar.gz: d6df3c6a6f508d8f75d1c994a14cff544dcb97bf428e15f6a2ef7b9cf462472c763562cccd12f4e2d98a3385d7c23c915eee83f61134c75e04257e31aba5b6eb
checksums.yaml.gz.sig ADDED
Binary file
data.tar.gz.sig ADDED
Binary file
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: humble_rpi-plugin-led.rb
4
+
5
+ require 'rpi'
6
+
7
+
8
+ class HumbleRPiPluginLed
9
+
10
+ def initialize(settings: {}, variables: {})
11
+
12
+ @pins = settings[:pins]
13
+
14
+ end
15
+
16
+ def on_led_message(message)
17
+
18
+ r = message.match(/(\d+)\s*(on|off|blink)\s*([\d\.]+)?(?:\s*duration\s)?([\d\.]+)?/)
19
+
20
+ if r then
21
+ index, state, seconds, raw_duration = r.captures
22
+ duration = raw_duration ? raw_duration.to_f : nil
23
+
24
+ a = case state
25
+
26
+ when 'on'
27
+ [:on, duration]
28
+
29
+ when 'off'
30
+ [:off]
31
+
32
+ when 'blink'
33
+ seconds = seconds ? seconds.to_f : 0.5
34
+ [:blink, seconds, duration: duration]
35
+ end
36
+
37
+ @led[index.to_i].send(*a)
38
+ end
39
+ end
40
+
41
+ def start()
42
+
43
+ @led = RPi.new(@pins).led if @pins.any?
44
+
45
+ end
46
+
47
+ alias on_start start
48
+
49
+
50
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: humble_rpi-plugin-led
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
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
+ 8ixkARkWAmV1MB4XDTE1MDYxMzIxMTYxNVoXDTE2MDYxMjIxMTYxNVowSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
+ ggEBAN9h3Ha14Rs8yS+G21RoIS6mmGDeWprq9g8RYPYxEJZvg0Wwk1xbTiDpnAtm
19
+ tU+h9ZCRQ1deJ+/ks14LiMZOAFCTGpSatz3LVanNLdA6s3WL99sQJZ7+urmbJNJ7
20
+ BeSdK81/4mC5hlDrgCIvDDWGHNdC5WTm44AcaKoyFp2Qd5DSqBm1XQE96TXe+2/H
21
+ N9ucLHcJXgzFi9W9VkErqND2BjZXjhVGy5Z0NcRYwspePnqN9p3ATEuaiLI9ZRfG
22
+ ffcT7yTHPD0fhXcRZLf4VWiouKdUZF+fbwulTSU09/AtL3bSVj3hZ6Ejx8mjdx/V
23
+ xqzy+Xa8d4LR15JNxsamxlEWBP0CAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
+ DwQEAwIEsDAdBgNVHQ4EFgQUna0flh+2gtohFw9ugTqf5FWTZfgwJgYDVR0RBB8w
25
+ HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAJwLC3IM2
27
+ ei5JrLUvTrz/nAtsQZKoUePsSSZjvZ56hnuu4a6WRyPEil/OfFh9uVdqh2vf6+hX
28
+ pGvJaRYhoTR4mi4J2oJttQfqw9BMKQ51fHpfFQfDo/yYLiPFtJP5wDp3qY2KLSqh
29
+ 4gLO/MEuYz7730S8+lBzK6HDchS2B8n1A8J5B3/Ka0ZcV7jTrtyoEcDyKRQ+YnR6
30
+ VFnzADGVP3BPhUzTlhgSqqUoyiAJ9kew6IxTP74k8S4SNCufxjs/mcTdMWHeitiO
31
+ DWZU516n825c7yCIYUbK4paHe+EmHf7LUyqjhB21vyAtbAXVBo9wFxFUrv8ledMm
32
+ 5HwpZH8LZVos/A==
33
+ -----END CERTIFICATE-----
34
+ date: 2015-06-14 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.2'
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 0.2.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.2'
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 0.2.0
56
+ description:
57
+ email: james@r0bertson.co.uk
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - lib/humble_rpi-plugin-led.rb
63
+ homepage: https://github.com/jrobertson/humble_rpi-plugin-led
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.6
84
+ signing_key:
85
+ specification_version: 4
86
+ summary: A humble_rpi plugin for LEDs
87
+ test_files: []
metadata.gz.sig ADDED
@@ -0,0 +1 @@
1
+ �wrH�u���WH�^�:D���eG��c����o�{�W\���*?� %�b}��"�?Xl�y�T�� ��:��i�� d �URu"/�j �{{w#5]�;�g���4