myfirmata-plugin-button 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: 32ad2256531f58146053ece378f1c0bf9eb9e9ae
4
+ data.tar.gz: 77fe5c04cc2d5299a10182af140e917263dbfc21
5
+ SHA512:
6
+ metadata.gz: 6531b38184a244837e7d807f4fee51af7af916edfa30e549dfc529569eeadfc67e69268711513d8f354e45ea188412aaf5dd8bfe12d24a16cdf7e525cd70a75e
7
+ data.tar.gz: 1b84ffabe77d2d989d5bfdbcbc1a2aa04739365a7a75e6dd88fad6129d3d85694faa0e3e6935d44bfea77b7d6a05fb43df25cfefc74272605fcdcf5d71053e85
checksums.yaml.gz.sig ADDED
Binary file
data.tar.gz.sig ADDED
@@ -0,0 +1,4 @@
1
+ '�D��|K�������ū�9a�p�N)���@#��g����ԅ7�p�'����-�b��&j�:Y֋����lhh.��� �y���U�>��k�f Y���^
2
+
3
+ m;u��@�/��4p�V���AL�|�������¤�e�\��\�I]� /�zNH�$���A�",����
4
+ ��gU�*E��,�<(_�જ�u�zɒ^C[S:v������<yb�����_�J��D�S���c�MzMg4�ҽ
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: myfirmata-plugin-button.rb
4
+
5
+ # a plugin for the myfirmata gem
6
+
7
+
8
+ class MyFirmataPluginButton
9
+
10
+
11
+ def initialize(arduino, settings: {}, variables: {})
12
+
13
+ @arduino = arduino
14
+ @settings, @variables = settings, variables
15
+
16
+ end
17
+
18
+ def start()
19
+
20
+ puts 'ready to detect button'
21
+
22
+ t = Time.now
23
+
24
+ notifier = @variables[:notifier]
25
+ topic = @variables[:device_id]
26
+ msg = @settings[:msg] || 'button pressed'
27
+ pinx = @settings[:pin] || 2
28
+ interval = @settings[:interval] || 1
29
+
30
+ @arduino.on :digital_read do |pin, high|
31
+
32
+ if pin == pinx and high and t + interval < Time.now
33
+ notifier.notice "%s: %s" % [topic, msg]
34
+ t = Time.now
35
+ end
36
+
37
+ end
38
+
39
+ end
40
+
41
+ alias on_start start
42
+
43
+
44
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: myfirmata-plugin-button
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
+ 8ixkARkWAmV1MB4XDTE3MDIwNDE3MTIzOVoXDTE4MDIwNDE3MTIzOVowSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
+ ggEBAMBEvgzYDjaWY4JcIIdFRyMiCaRx2eKkU3VxQRViCsvVycF0J+NPOOObSPgZ
19
+ qhfkFz4/v9TK8BmkIrVXVNh8KJVxAmrLRBB4ZQ/Smj/hlQ7OPBA5ukvjVCQMULk2
20
+ 4Zec3uKaFx7x1bKAqinPJUW9up9xQnjvF6VAolXdlMPGaQTl1VEZuNTieLzpXBdq
21
+ KSkOQuPghDXsHXc1I3BTHep7IivE8PAfO8PZbnXUUJxB2fmJjJDoNEHG7NcC/kEI
22
+ 5swKar4+N+OOar3NqBgEzQmGw7BaX2W8HD4kQ61TzFVchOuW/V83QBd6px1r1Cdm
23
+ YWWp7p9mTKuu6yUOVJ37vclxVyUCAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
+ DwQEAwIEsDAdBgNVHQ4EFgQUVGWaYAOXyfnL6453XCFNDrS+q8IwJgYDVR0RBB8w
25
+ HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAqLpSXRch
27
+ BjgcZyXkeBClhgz0X+NvMQ6QptoFxL1ZcPuNmQOKA5f937PgweHRVpWIC0+sJSHZ
28
+ 4xQowde4pZJnB7OdDsOVcp6NS+5oVvBrx0E9qFo8Yc0xviSvdNDL9KG0BM+h+J8/
29
+ +Eu1gokpjCiaPbvTitR6rDUnmB1ToTE4wrkLehGBs2h9rjEH+5MVexULQ7sZjbwi
30
+ VqpM2FupNu1OwMkhQ5F6DkL0ZweieRZPbkiVg1Y+a7Np7og4iVarX44h35Gd7NHJ
31
+ VArvH4OZeQQbM3zvvQJLR0I2p8FuDHHPKjBOsxEPcRTUBDEbfilFzAEuOnK0BsLH
32
+ LNY8hDzWEvja1w==
33
+ -----END CERTIFICATE-----
34
+ date: 2017-02-04 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-button.rb
43
+ homepage: https://github.com/jrobertson/myfirmata-plugin-button
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: A MyFirmata plugin which detects a button press and publishes a message to
67
+ the SimplePubSub broker.
68
+ test_files: []
metadata.gz.sig ADDED
Binary file