rpi_vibratingmotor 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 398947c0c27f1314cf8eb3f5decf45e40f376e6a
4
+ data.tar.gz: 7627efe27745078d66536774bdfd6626fc921e83
5
+ SHA512:
6
+ metadata.gz: 7a13a8eb54a6afbd43dc0ede6b73c4bfa22e1231db74a7ff35a962597a8c85b6dbe65aaec528b2ef8a766682204b89f1dfa173bc783ad63d7f84b9fe86a92e96
7
+ data.tar.gz: e4634905ed500adf09a1bd80af102312d1d04329606dabbd268a46a00379a87d6a73c3bab75fb7f0f3a6247affb0087acb2027378b7633aeef9e270d704206a0
Binary file
Binary file
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: rpi_vibratingmotor.rb
4
+
5
+ require 'rpi'
6
+
7
+
8
+ class RPiVibratingMotor < RPi
9
+
10
+ def initialize(gpio_pin)
11
+ super(gpio_pin)
12
+ end
13
+
14
+ def action_required()
15
+ @t = Thread.new{ pin.oscillate 0.2 }
16
+ end
17
+
18
+ def incoming_instant_message()
19
+ pin.oscillate 0.1, duration: 0.3
20
+ end
21
+
22
+ def incoming_email_message()
23
+ pin.oscillate 0.3, duration: 0.7
24
+ end
25
+
26
+ def incoming_call()
27
+ @t = Thread.new{ loop { pin.oscillate 0.5, duration: 2; sleep 3} }
28
+ end
29
+
30
+ def quiet_action_required()
31
+
32
+ @t = Thread.new do
33
+ loop {pin.oscillate 0.01, duration: 0.2; sleep 0.4}
34
+ end
35
+
36
+ end
37
+
38
+ def quiet_confirmation()
39
+ pin.oscillate 0.05, duration: 0.2
40
+ end
41
+
42
+ def quiet_incoming_call()
43
+
44
+ @t = Thread.new do
45
+ loop do
46
+ 2. times { pin.oscillate 0.01, duration: 0.3; sleep 0.5}; sleep 1.5
47
+ end
48
+ end
49
+
50
+ end
51
+
52
+ def quiet_incoming_message()
53
+ pin.oscillate 0.01, duration: 0.5
54
+ end
55
+
56
+ def stop()
57
+ pin.stop
58
+ @t.exit
59
+ end
60
+ end
61
+
62
+ if __FILE__ == $0 then
63
+
64
+ m = RPiVibratingMotor.new(ARGV.first)
65
+ m.incoming_instant_message()
66
+
67
+ end
68
+
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rpi_vibratingmotor
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
+ 8ixkARkWAmV1MB4XDTE2MDIyNzE0MzAxOFoXDTE3MDIyNjE0MzAxOFowSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
+ ggEBAK5lxJgaYmrYIrhP05MAA7WvsCdmAMLRZm1f2QpT4gmi/YS/0IHtuCTz+c8S
19
+ 4xtxR5MXre46zaSsJccst1EntFkw2zEPvG6VYoOUis+IytZcP3+1WXpkozK+8hoH
20
+ M20uIpdNwLFm070WozmvUfkjrEDIKsepOjKz/6c+Qd1Y3sTu2tyhbBdWqquLhGfn
21
+ 1NUcn8HB7ZeeNH3ZPkvPbxNewxh/3r+uY+0lmdlYdqCi7ML+8rcWQWnjlEgHSd6i
22
+ hB5qixT13U7p49BVSjYwD8JSUaf5GbYHmf5lVn7HcOOp1EmwGzPo2h49FcPzvi0s
23
+ bRP/P42S1Dlas9epOUG8gmXAOxcCAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
+ DwQEAwIEsDAdBgNVHQ4EFgQUDEhmnC0YCKkPDznCau86Vra1d58wJgYDVR0RBB8w
25
+ HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEARSO91PEk
27
+ V3HoM8vDP31zTJ6Lg4t7iJ8DGznac/sd43EzE2mXQ2sAWjE1h0AlSdt6Zma9mYlx
28
+ gMMsxgmQ7c0q/vKw99nMctB3Atr8TjdewAT3aqR6mYEhACq7fh/ZU21GahZ1XWpP
29
+ n2ordDi41ga7HhIKmNAbq1BnHAt9hmUZciUpr73pXwSYvf5Lzj1g9l0Cl6ea8nFF
30
+ f7aP4ky0CJJd7ZkD5EnhVWwrE7a49hx126Al/fE4fdtn+raoH3lo30sc7BvcrOZZ
31
+ Di99ohwk1me/RHxf6la596heAwsWcTp8i7nOjETStOSbJRvqiR2yiXb7akg3PK52
32
+ kIxJy2qPpx4qMA==
33
+ -----END CERTIFICATE-----
34
+ date: 2016-02-27 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.5
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.5
56
+ description:
57
+ email: james@r0bertson.co.uk
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - lib/rpi_vibratingmotor.rb
63
+ homepage: https://github.com/jrobertson/rpi_vibratingmotor
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: Uses a vibrating motor connected to the Raspberry Pi to alert the user of
87
+ a new message etc.
88
+ test_files: []
Binary file