1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8">
5 <meta http-equiv=
"Content-Style-Type" content=
"text/css">
7 <meta name=
"Generator" content=
"Cocoa HTML Writer">
8 <meta name=
"CocoaVersion" content=
"824.42">
9 <style type=
"text/css">
10 p
.p1
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
}
11 p
.p2
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; min-height: 14.0px}
12 p
.p3
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; min-height: 12.0px}
13 p
.p4
{margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica
}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco
; min-height: 12.0px}
15 p
.p6
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica
}
16 p
.p7
{margin: 0.0px 0.0px 0.0px 85.0px; text-indent: -85.0px; font: 12.0px Helvetica
}
17 p
.p8
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco
; color: #5c3a26; min-height: 12.0px}
18 p
.p9
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco
; color: #bf0000}
19 p
.p10
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco
; color: #000000; min-height: 12.0px}
20 p
.p11
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco
; color: #000000}
21 p
.p12
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco
; color: #bf0000; min-height: 12.0px}
22 p
.p13
{margin: 0.0px 0.0px 0.0px 85.0px; text-indent: -85.0px; font: 12.0px Helvetica
; min-height: 14.0px}
23 p
.p14
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 14.0px Helvetica
}
24 p
.p15
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica
; min-height: 14.0px}
25 p
.p16
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #5c3a26; min-height: 12.0px}
26 p
.p17
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #000000}
27 p
.p18
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #000000; min-height: 12.0px}
28 p
.p19
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #bf0000}
29 span
.s1
{font: 18.0px Helvetica
}
30 span
.s2
{color: #1c3cd4}
31 span
.s3
{font: 9.0px Monaco
}
32 span
.s4
{color: #000000}
33 span
.s5
{color: #0000bf}
34 span
.s6
{font: 9.0px Monaco
; color: #bf0000}
35 span
.s7
{color: #bf0000}
36 span
.s8
{color: #007300}
37 span
.Apple-tab-span
{white-space:pre
}
41 <p class=
"p1"><span class=
"s1"><b>WiiMote
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></span><b>use the Nintendo (tm) Wii Remote
</b><span class=
"s1"><b><span class=
"Apple-tab-span"> </span></b></span></p>
42 <p class=
"p2"><br></p>
43 <p class=
"p1"><b>Inherits from:
</b><a href=
"../Core/Object.html"><span class=
"s2"><b>Object
</b></span></a></p>
44 <p class=
"p3"><br></p>
45 <p class=
"p1">The WiiMote class allows you to access the WiiMote from SuperCollider, both to receive data from the device, as well as send data to the device.
</p>
46 <p class=
"p2"><br></p>
47 <p class=
"p2"><br></p>
48 <p class=
"p4"><b>Some Important Issues Regarding WiiMote
</b></p>
49 <p class=
"p2"><br></p>
50 <p class=
"p1">This class has been developed to work both on the Mac and on Linux. The interface is mostly the same, but there are some usage issues on the Mac.
</p>
51 <p class=
"p1">Personally, I found that it works better with an external BlueTooth receiver, than with the internal one (tested on the MacBook Pro). I also found that on the Mac, I have to connect, disconnect and then reconnect to get everything to work properly.
</p>
52 <p class=
"p2"><br></p>
53 <p class=
"p1">The IR options, as well as the Classic controller have not been tested (due to lack of access to either complementary device by the developer).
</p>
54 <p class=
"p2"><br></p>
55 <p class=
"p4"><b>Creation / Class Methods
</b></p>
56 <p class=
"p5"><br></p>
57 <p class=
"p6"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span><b>*start(updtime)
</b></p>
58 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Starts the eventloop. Only really necessary on Mac, but use it for cross platform robustness.
</p>
59 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>updtime
</b>- updatetime of the eventloop in milliseconds
</p>
60 <p class=
"p5"><br></p>
61 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>*discover
</b></p>
62 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Discovers a new device. This calls for the creation of a new device and class instance by calling the method
<b>new
</b>.
<b>new
</b> should not be called directly. When
<b>discover
</b> is called, the buttons
<b>1</b> and
<b>2</b> on the Wii Remote should be pushed to put the device in discovery mode.
</p>
63 <p class=
"p5"><br></p>
64 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>*all
</b></p>
65 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Returns an Array with all WiiMote devices.
</p>
66 <p class=
"p8"><br></p>
67 <p class=
"p9"><span class=
"s4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// Example to start up:
</p>
68 <p class=
"p9"><span class=
"s4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s5">WiiMote
</span><span class=
"s4">.start;
<span class=
"Apple-converted-space"> </span></span>// start the eventloop
</p>
69 <p class=
"p9"><span class=
"s4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s5">WiiMote
</span><span class=
"s4">.discover;
</span>// discover a new device
</p>
70 <p class=
"p9"><span class=
"s4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s5">WiiMote
</span><span class=
"s4">.all;
<span class=
"Apple-converted-space"> </span></span>// post an array of all devices
</p>
71 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
72 <p class=
"p9"><span class=
"s4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// cleanup:
</p>
73 <p class=
"p9"><span class=
"s4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s5">WiiMote
</span><span class=
"s4">.closeAll;
</span>// close all devices
</p>
74 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s5">WiiMote
</span>.stop;
</p>
75 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
76 <p class=
"p6"><span class=
"s6"><span class=
"Apple-tab-span"> </span></span><b>*closeAll
</b></p>
77 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Close all WiiMote devices.
</p>
78 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
79 <p class=
"p6"><span class=
"s6"><span class=
"Apple-tab-span"> </span></span><b>*stop
</b></p>
80 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Stops the eventloop. Only really necessary on Mac, but use it for cross platform robustness.
</p>
81 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
82 <p class=
"p14"><b>Accessing Instance and Class Variables
</b></p>
83 <p class=
"p15"><br></p>
84 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>dumpEvents_( bool )
</b></p>
85 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>dumpEvents
</b></p>
86 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>dump incoming events for debugging purposes
</p>
87 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>spec
</b></p>
88 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Returns the device specification, with symbolic names for each item. Each name links to the current value.
</p>
89 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>actionSpec
</b></p>
90 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Returns the device action specification, with symbolic names for each item. Each name in the dictionary links to an action to be performed upon receiving a new value.
</p>
91 <p class=
"p15"><br></p>
92 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>closeAction( aFunction )
</b></p>
93 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Set an action to be performed when the device closes
</p>
94 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>connectAction( aFunction )
</b></p>
95 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Set an action to be performed when the device connects
</p>
96 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>disconnectAction( aFunction )
</b></p>
97 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Set an action to be performed when the device disconnects
</p>
98 <p class=
"p15"><br></p>
99 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>at( key )
</b></p>
100 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Get the value of a device property at the given key
</p>
101 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
102 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>setAction( key, aFunction )
</b></p>
103 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Set an action to be performed when the value of
<b>key
</b> changes. The key name must be one that occurs in the spec.
</p>
104 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>removeAction( key )
</b></p>
105 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Remove the previously defined action at the
<b>key
</b></p>
106 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>close
</b></p>
107 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Close the device
<span class=
"Apple-tab-span"> </span></p>
108 <p class=
"p15"><span class=
"Apple-tab-span"> </span></p>
109 <p class=
"p6">The properties of the Wii Remote:
</p>
110 <p class=
"p15"><br></p>
111 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>battery
</b></p>
112 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Returns the current battery status of the device
</p>
113 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>ext_type
</b></p>
114 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Returns the extension type that is connected
</p>
115 <p class=
"p15"><br></p>
116 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>remote_buttons
</b></p>
117 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Returns an Array with the current button values
</p>
118 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>remote_motion
</b></p>
119 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Returns an Array with the current acceleration values (x,y,z, orientation). Orientation is Mac only.
</p>
120 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>remote_ir
</b></p>
121 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Returns an Array with the found IR objects. (not tested!).
</p>
122 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>remote_leds
</b></p>
123 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Returns an Array with the current LED values
</p>
124 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
125 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>setLEDState( id, value )
</b></p>
126 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Set the LED with number
<b>id
</b> to value
<b>value
</b> (
1=on,
0=off).
</p>
127 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>rumble( value )
</b></p>
128 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Turn on the rumble,
<b>value
</b> (
1=on,
0=off).
</p>
129 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
130 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>enable( onoff )
<span class=
"Apple-converted-space"> </span></b></p>
131 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Enable the device
</p>
132 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>enableExpansion( onoff )
<span class=
"Apple-converted-space"> </span></b></p>
133 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Enable the device expansion (nunchuk or classic controller)
</p>
134 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>enableButtons( onoff )
<span class=
"Apple-converted-space"> </span></b></p>
135 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Enable the buttons on the device
</p>
136 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>enableMotionSensor( onoff )
<span class=
"Apple-converted-space"> </span></b></p>
137 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Enable the motion sensor on the device
</p>
138 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>enableIRSensor( onoff )
<span class=
"Apple-converted-space"> </span></b></p>
139 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Enable the IR sensor on the device
</p>
140 <p class=
"p15"><br></p>
141 <p class=
"p6">The properties of the NunChuk:
</p>
142 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>nunchuk_buttons
</b></p>
143 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Returns an Array with the current button values
</p>
144 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>nunchuk_motion
</b></p>
145 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Returns an Array with the current acceleration values (x,y,z, orientation). Orientation is Mac only.
</p>
146 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>nunchuk_stick
</b></p>
147 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Returns an Array with the current stick values
</p>
148 <p class=
"p15"><br></p>
149 <p class=
"p6">The properties of the Classic Controller:
</p>
150 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>classic_buttons
</b></p>
151 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Returns an Array with the current button values
</p>
152 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>classic_stick1
</b></p>
153 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Returns an Array with the current stick values of stick
1</p>
154 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>classic_stick2
</b></p>
155 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Returns an Array with the current stick values of stick
2</p>
156 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>classic_analog
</b></p>
157 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Returns an Array with the current analog values
</p>
158 <p class=
"p2"><br></p>
159 <p class=
"p14"><b>Examples
</b></p>
160 <p class=
"p16"><br></p>
161 <p class=
"p9">// Example to start up and view values
</p>
162 <p class=
"p9"><span class=
"s4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s5">WiiMote
</span><span class=
"s4">.start;
<span class=
"Apple-converted-space"> </span></span>// start the eventloop
</p>
163 <p class=
"p9"><span class=
"s4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s5">WiiMote
</span><span class=
"s4">.discover;
</span>// discover a new device (wait for post about connected)
</p>
164 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
165 <p class=
"p9"><span class=
"s4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s5">WiiMote
</span><span class=
"s4">.all;
<span class=
"Apple-converted-space"> </span></span>// post an array of all devices
</p>
166 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
167 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s5">WiiMote
</span>.all[
0];
</p>
168 <p class=
"p9"><span class=
"s4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x =
</span><span class=
"s5">WiiMoteGUI
</span><span class=
"s4">.new( w );
</span>// create a GUI (only covers the WiiMote and NunChuk currently)
</p>
169 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
170 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.enableMotionSensor(
1 );
</p>
171 <p class=
"p17"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.enableExpansion(
1 );
</p>
172 <p class=
"p18"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
173 <p class=
"p17"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.setLEDState(
0,
1 );
<span class=
"s7">// turn the first LED on
</span></p>
174 <p class=
"p19"><span class=
"s4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.rumble(
1 );
</span>// rumble the device
</p>
175 <p class=
"p19"><span class=
"s4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.rumble(
0 );
</span>// rumble the device
</p>
176 <p class=
"p18"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
177 <p class=
"p19"><span class=
"s4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.setAction(
</span><span class=
"s8">\bA
</span><span class=
"s4">, {
</span><span class=
"s5">|v|
</span><span class=
"s4"> v.postln; } );
</span>// post the value when button A changes.
</p>
178 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.removeAction(
<span class=
"s8">\bA
</span> );
</p>
179 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
180 <p class=
"p9"><span class=
"s4"><span class=
"Apple-tab-span"> </span></span>// (MacOSX) if you do not see any changes in the motion sensors, then the connection is bad.
</p>
181 <p class=
"p9"><span class=
"s4"><span class=
"Apple-tab-span"> </span></span>// push the red button inside the battery compartment, or the buttons
1 and
2 on the WiiMote and start over again to discover...
</p>
182 <p class=
"p10"><span class=
"Apple-tab-span"> </span></p>
183 <p class=
"p9"><span class=
"s4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s5">WiiMote
</span><span class=
"s4">.discover;
</span>// discover a new device
</p>
184 <p class=
"p9"><span class=
"s4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s5">WiiMote
</span><span class=
"s4">.all;
<span class=
"Apple-converted-space"> </span></span>// post an array of all devices
</p>
185 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
186 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s5">WiiMote
</span>.all[
1];
</p>
187 <p class=
"p9"><span class=
"s4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x.w.close;
</span>// close previous window
</p>
188 <p class=
"p9"><span class=
"s4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x =
</span><span class=
"s5">WiiMoteGUI
</span><span class=
"s4">.new( w );
</span>// create a GUI (only covers the WiiMote and NunChuk currently)
</p>
189 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
190 <p class=
"p9"><span class=
"s4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// now it should work..., if not, repeat the exercise...
</p>
191 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
192 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
193 <p class=
"p9"><span class=
"s4"><span class=
"Apple-tab-span"> </span></span>// clean up
</p>
194 <p class=
"p9"><span class=
"s4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s5">WiiMote
</span><span class=
"s4">.closeAll;
</span>// close all devices
</p>
195 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s5">WiiMote
</span>.stop;
</p>
196 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x.w.close;
</p>