swing

Location

$REVOLUTION_SDK_ROOT/build/demos/kpaddemo

Description

In this demo, the program recognizes the direction the Wii Remote has been waved and displays the direction on the TV screen using an arrow.

Note: Be sure to swing the Wii Remote so that its top surface (the side where A Button and others are located) remains parallel with the floor. The correct direction will not be recognized if the Wii Remote is swung at a tilted angle.

Source File Organization

swing.c This source file contains the algorithm for detecting the direction of swing. It is possible to adjust the feel of recognition by editing the values of macro constants defined in this file.
graphic.h, graphic.c The collection of subroutines for simple graphics drawing.
kfont.h, kfont.c The collection of subroutines that displays text and numerals onscreen.

Description of swing.c

The following table gives a simple description of the functions defined in swing.c.

init_sample() This function initializes settings for loading KPAD acceleration data.
work_sample() This function is called once per frame to perform recognition.
draw_sample() This function draws the result of recognition.

Note

See Also

Revision History

2007/04/11 Used red letters to emphasize the note giving conditions for correct recognition.
2007/03/05 Included example parameter settings for detecting weak swings.
2007/03/02 Initial version.


CONFIDENTIAL