wiimote_handle(var num)

Returns a handle of the bluetooth input device - such as a WiiMote®, Nunchuk® or Balance Board - with the given number (1..4). If a bluetooth input device with the given number is not detected, the function returns 0. The device must be switched on and connected (see below) before the start of the application, and joysticks must not be disabled with -nj command line option.


Returns the number of all connected bluetooth input devices. Note: the Bluesoleil driver always detects all devices even if they are not connected sanymore.

wiimote_status(var handle, void* wiimote)

Updates the device status - motion sensors, orientation, IR sensor, analog stick and button states - into the WIIMOTE struct passed as second argument. The WIIMOTE struct is defined in include\ackwii.h.

wiimote_smoothfac(var handle, var fac)

Sets a factor (0..1) for smoothing the Wiimote angle data.

wiimote_led(var handle, var ledmask)

Turns the 4 LEDs on or off.

wiimote_vibration(var handle, var on)

Turns the vibration on (1) or off (0).

wiimote_ir(var handle, var on)

Enables/disables the infrared camera. The camera is able to detect the positions of up to 4 infrared spots, and allows to use the WiiMote as a pointing device.

wiimote_ir_sensitivity(var handle, var level)

Sets the sensitivity level for the infrared camera. The IRPTR struct (see include\ackwii.h) can be used for retrieving raw data about the pointer position.

wiimote_connected(var handle)

wiimote_nunchuk_connected(var handle)

wiimote_classic_connected(var handle)

wiimote_guitar_connected(var handle)

wiimote_balanceboard_connected(var handle)

wiimote_ir_active(var handle)

wiimote_vibration_active(var handle)

Checks whether a certain device is connected and active. Returns 0 for inactive and nonzero for active.

wiimote_battery(var handle)

Returns the battery charge in percent (0..100).


handle - Handle for identifying the WiiMote.
on - 0 for off and 1 for on.
fac - 0 for no effect, 0.999 for full effect.
ledmask - Binary value (0..15) with 1 bit for every LED. 1 = on, 0 = off.

Connecting a WiiMote to the PC

Only devices that are switched on, set to a certain number (default = 0), and connected to the PC before the start of the application can be used with the wiimote functions. Setting the WiiMote to a certain number is described in the WiiMote manual. Here's how to to connect it to the Bluetooth stack of the PC (also called 'pairing').

Connect to Windows' built-in Bluetooth stack:

Connect to the Toshiba® Bluetooth stack:

Disconnect/unpair to save power (any stack):



A7.6  C 


// Sample script demonstrating usage of a Bluetooth input device
// The WiiMote must be connected to the PC prior to starting the application
// For connecting a WiiMote, see manual->engine functions->wiimote
#include <acknex.h>
#include <default.c>
#include <ackwii.h>

// assigned to [A] button
void toggleVibration (var handle, WIIMOTE* wiimote)
	wiimote_vibration(handle, 1 - wiimote.status.vibration);		

WIIMOTE wiimote;

void main ()
// get a handle to the first Wiimote
	var wii_handle = wiimote_handle(1);
	if (!wii_handle) printf("No WiiMote connected!");

// create a screen entity to be controlled by the WiiMote
   you = ent_createlayer("earth.mdl",0,0);
// assign a function to Wiimote [A] button
	wiimote.event.on_a = toggleVibration;

	while (1)
// update buffer with data coming from Wiimote

See also:

joystick values

► latest version online