myfirmata-plugin-led 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 +7 -0
- checksums.yaml.gz.sig +1 -0
- data.tar.gz.sig +0 -0
- data/lib/myfirmata-plugin-led.rb +49 -0
- metadata +67 -0
- metadata.gz.sig +3 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e8e6d6144fbe8bdf93ddc18eb21698457c5dce8d
|
4
|
+
data.tar.gz: 66e70c56869a82fe64ab035dcf33b36c84a68872
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9a3b4e51a09a9462c43a751afc3694d7d158529a5973f60979b7e753b72ae024816f142875f952ffd1a1ff249b077240a37181f205dc89c397277515463690ec
|
7
|
+
data.tar.gz: e11c75f036a3703dc5c0ff81220beb812c2d36c4ce651d14387829dbbe2b1daca8337061f64a299225f14ef82a22afe36e6dd795029e111c90500b772b671a7f
|
checksums.yaml.gz.sig
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
`�`n���gB�`n��N���u'�
|
data.tar.gz.sig
ADDED
Binary file
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: myfirmata-plugin-led.rb
|
4
|
+
|
5
|
+
# a plugin for the myfirmata gem
|
6
|
+
|
7
|
+
|
8
|
+
class MyFirmataPluginLed
|
9
|
+
|
10
|
+
|
11
|
+
def initialize(arduino, settings: {}, variables: {})
|
12
|
+
|
13
|
+
@arduino = arduino
|
14
|
+
@settings, @variables = settings, variables
|
15
|
+
x = settings[:pins] || settings[:pin]
|
16
|
+
|
17
|
+
@pins = case x
|
18
|
+
when Fixnum
|
19
|
+
[x]
|
20
|
+
when Integer
|
21
|
+
[x]
|
22
|
+
when String
|
23
|
+
[x]
|
24
|
+
when Array
|
25
|
+
x
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
def on_led_message(message)
|
31
|
+
|
32
|
+
r = message.match(/(\d+)\s*(on|off)/)
|
33
|
+
|
34
|
+
if r then
|
35
|
+
|
36
|
+
index, state = r.captures
|
37
|
+
@arduino.digital_write @pins[index.to_i], state == 'on'
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def start()
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
alias on_start start
|
47
|
+
|
48
|
+
|
49
|
+
end
|
metadata
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: myfirmata-plugin-led
|
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
|
+
8ixkARkWAmV1MB4XDTE3MDQxNTE4MzQxNFoXDTE4MDQxNTE4MzQxNFowSDESMBAG
|
16
|
+
A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
|
17
|
+
EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
18
|
+
ggEBAKvk8bbI6xMGYrSrk1QT5z9delT2uFdmBlFr9gZmf+45+BZfSJ/v/BOq0NX4
|
19
|
+
j9azSAV2xJOXEBe00qo8hwabePDsUUO5YdAhpcxQVN7DW9s8c9DWdjkopWi/xT9N
|
20
|
+
xSHKbenjZapAn+HWeGXhfnLCnfCA2K1VvFtIYOxv91gYMsUL4vWMmXodMhS7BgaD
|
21
|
+
hEpclRJYTlUlwurNlb4isw8DN3wDdSBEOGV58NkzC8zHBI/4Tzni623fny7KSGfs
|
22
|
+
ny4wX9S2fkdlh/opAfy1eJAqTYM6i9qAPc1fda5XsHNqAQf7TsUZUdE4WSwmWDT3
|
23
|
+
+vV+L2hhjqxAkh8EbefeJa3yxHUCAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
|
24
|
+
DwQEAwIEsDAdBgNVHQ4EFgQUK6+33XPu1C65Le7jtd0mb+sjxbEwJgYDVR0RBB8w
|
25
|
+
HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
|
26
|
+
c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAY2aa4aTu
|
27
|
+
dRuN+xF3d4xu3H/HKMGzG7G07f7HlgYshfwEBsXfzsoGgnmNbESNrZRBgDJYkMlc
|
28
|
+
xcHYVqd23IDmFWC6xXpjz72KQlPlkwea1Xcn+oXqeQgiqAWX26QEh/VuAsaZH2tE
|
29
|
+
HZsnKOin0JVs7LBIO9s5yGYiWfNMD8Lp7vxwjKHRF3LS8vF5K02Q6XnZW/mbx3Qg
|
30
|
+
GELwW9TKC02d+/IZMJ3Uy7gcvXv8Mi+z9CmWScobZkNzcVxPQhKERRVQw67FT7a9
|
31
|
+
hA5TmpepRkzABj64ycUlVOaQDWrrrgDtCitUgrNa9JNyyT+PNkSiwDRC+eXZiQkn
|
32
|
+
pZEM1cvtbpDkMA==
|
33
|
+
-----END CERTIFICATE-----
|
34
|
+
date: 2017-04-15 00:00:00.000000000 Z
|
35
|
+
dependencies: []
|
36
|
+
description:
|
37
|
+
email: james@jamesrobertson.eu
|
38
|
+
executables: []
|
39
|
+
extensions: []
|
40
|
+
extra_rdoc_files: []
|
41
|
+
files:
|
42
|
+
- lib/myfirmata-plugin-led.rb
|
43
|
+
homepage: https://github.com/jrobertson/myfirmata-plugin-led
|
44
|
+
licenses:
|
45
|
+
- MIT
|
46
|
+
metadata: {}
|
47
|
+
post_install_message:
|
48
|
+
rdoc_options: []
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
requirements: []
|
62
|
+
rubyforge_project:
|
63
|
+
rubygems_version: 2.6.8
|
64
|
+
signing_key:
|
65
|
+
specification_version: 4
|
66
|
+
summary: myfirmata-plugin-led
|
67
|
+
test_files: []
|
metadata.gz.sig
ADDED