Wiimote

From X-Moto
Jump to: navigation, search

Okay Let's Get working!

Programs you will need

You will probably need IVT Bluesoleil bluetooth software, depending on your Bluetooth Adapter.

You will also need GlovePIE Programmable input emulator.

Now we can start connecting your wiimote to your Windows PC.

Connecting wiimote to your Windows PC

Open IVT Bluesoleil by left clicking the System tray icon and choosing "Display". Press the Big orange ball (My device) then put your wiimote in "discovery mode" by pressing buttons 1 and 2 simultaneously. Then wait and press the buttons again if the "discovery mode" (blinking of the LEDs) ends. Then when the wiimote has been found, it's name should be something like Nintendo RVL-CNT-01, left click the image of it and choose "Refresh Services" and put your wiimote in discovery mode again. When the connection has been made you can open GlovePIE.

Scripting with GlovePIE

The Getting started at Help->Getting Started is good. And after that you can take a look at the preliminary documentations at Help->Preliminary Documentations. If you are lazy and want get to the action now, here's some basic code for playing x-moto with the D-Pad of a Wiimote, which you can modify and copy freely.

The script:

/*Wiimote script for X-Moto Version 0.1.0
 _________________
|                 |
|    Controls:    |
|_________________|
-----------------------------------------------------------
Notice that the controls are designed for horizontal usage!
-----------------------------------------------------------
Pad:
Up = Accelerate
Down = Brake
Left = Lift left wheel
Right = Lift right wheel
Buttons:
A = Enter
+ = Menu/Pause (ESC)
Home = Windows
1 = Brake (Too!)
2 = Accelerate (Too!)
B = Change direction

*/

//Buttons and matching keys
keyboard.Up = wiimote.Two
keyboard.Down = wiimote.One
keyboard.Left = wiimote.Up
keyboard.Right = wiimote.Down
keyboard.Enter = wiimote.A
keyboard.Escape = wiimote.Plus
keyboard.Windows = wiimote.Home
keyboard.Up = wiimote.Right
keyboard.Down = wiimote.Left
keyboard.Space = wiimote.B

//LEDs look somewhat like KITT's grill from Knight Rider ;)
if 0 = 0 then
if var.kitt = 0 then
wiimote.Leds = 1
endif
if var.kitt = 1 then
wiimote.Leds = 3
endif
if var.kitt = 2 then
wiimote.Leds = 6
endif
if var.kitt = 3 then
wiimote.Leds = 12
endif
if var.kitt = 4 then
wiimote.Leds = 8
endif
if var.kitt = 5 then
wiimote.Leds = 12
endif
if var.kitt = 6 then
wiimote.Leds = 6
endif
if var.kitt = 7 then
wiimote.Leds = 3
endif
wait 200 ms
var.kitt = (var.kitt + 1) % 8
endif

The LED script is copied from another open source script.

Enjoy

Code your own scripts for other games (and other stuff) and check the script samples in the samples folder in the GlovePIE installation folder.