wii-robotic-arm 0.1.1 → 0.1.2

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/wii-robotic-arm.rb +20 -3
  2. metadata +2 -2
@@ -6,18 +6,35 @@ require 'robotic-arm'
6
6
  require 'simple_wiimote'
7
7
 
8
8
  class WiiRoboticArm < SimpleWiimote
9
-
9
+
10
10
  def initialize()
11
11
  super()
12
12
  @ra = RoboticArm.new
13
+ @played = nil
14
+ @terminator = ['home']
13
15
  end
14
16
 
15
17
  protected
16
18
 
17
19
  def on_btn_plus_press(wm) @ra.led.on end
18
20
  def on_btn_minus_press(wm) @ra.led.off end
19
- def on_btn_plus_press(wm) @ra.led.on end
20
- def on_btn_minus_press(wm) @ra.led.off end
21
+
22
+ def on_btn_1_press(wm)
23
+ @ra.recording.method(@ra.recording? ? :stop : :start).call
24
+ end
25
+
26
+ def on_btn_2_press(wm)
27
+ if @played != :reverse then
28
+ puts 'playing in reverse'
29
+ @ra.recording.reverse_play
30
+ @played = :reverse
31
+ else
32
+ puts 'playing forward'
33
+ @ra.recording.playback
34
+ @played = :played
35
+ end
36
+ end
37
+
21
38
  def on_btn_left_down(wm) @ra.gripper.open end
22
39
  def on_btn_left_up(wm) @ra.gripper.stop end
23
40
  def on_btn_right_down(wm) @ra.gripper.close end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: wii-robotic-arm
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.1
5
+ version: 0.1.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - James Robertson
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-12-20 00:00:00 Z
13
+ date: 2012-12-24 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: simple_wiimote