wiimagickcam 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/wiimagickcam.rb +34 -0
  2. metadata +77 -0
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: wiimagickcam.rb
4
+
5
+ require 'simple_wiimote'
6
+ require 'magickcam'
7
+
8
+ class WiiMagickCam
9
+
10
+ def self.start(raw_filename="webcam%03d.jpg")
11
+
12
+ mcam = MagickCam.new
13
+ swm = SimpleWiimote.new
14
+ i = 1
15
+
16
+ swm.led = 1
17
+ puts 'press button B (trigger) to take a webcam snapshot'
18
+
19
+ swm.events[WiiMote::BTN_B] = -> {
20
+ swm.led = 12
21
+
22
+ filename = raw_filename % i.to_s
23
+ mcam.snapshot(filename)
24
+ i += 1
25
+ swm.led = 1
26
+ }
27
+
28
+ swm.activate # deactivate by pressing button A
29
+ swm.led = 0
30
+ swm.close
31
+ end
32
+
33
+ end
34
+
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wiimagickcam
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.1.1
6
+ platform: ruby
7
+ authors:
8
+ - James Robertson
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-12-16 00:00:00 +00:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: magickcam
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: "0"
25
+ type: :runtime
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: simple_wiimote
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: "0"
36
+ type: :runtime
37
+ version_requirements: *id002
38
+ description:
39
+ email:
40
+ executables: []
41
+
42
+ extensions: []
43
+
44
+ extra_rdoc_files: []
45
+
46
+ files:
47
+ - lib/wiimagickcam.rb
48
+ has_rdoc: true
49
+ homepage:
50
+ licenses: []
51
+
52
+ post_install_message:
53
+ rdoc_options: []
54
+
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: "0"
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: "0"
69
+ requirements: []
70
+
71
+ rubyforge_project:
72
+ rubygems_version: 1.5.2
73
+ signing_key:
74
+ specification_version: 3
75
+ summary: wiimagickcam
76
+ test_files: []
77
+