Chad Phillips > Linux-Input-Wiimote-0.03 > Linux::Input::Wiimote

Download:
Linux-Input-Wiimote-0.03.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 0.03   Source  

NAME ^

 Wiimote

SYNOPSIS ^

 This is a perl interface to the C library libcwiimote ( http://sourceforge.net/projects/libwiimote/ ).
 It implements most of that API and provides access to most functions of the wiimote.

 libcwiimote version .03 must be installed and the bluetooth dameon must be running

 Auto discovery is not yet built in.  You must know the id of your wiimote.  You can use hcitool scan
 to find the id.

 Methods:

 wiimote_connect( ID OF YOUR WIIMOTE ): pass in the id of your wiimote such as '00:19:1D:75:CC:30'.  Returns 0 on success
 wiimote_update : updates the wiimote.  Should be called often

 wiimote_discover: discovers and returns the id of the last wiimote it sees.  WARNING, this method has bugs and will segfault if it doesn't find a wii quickly
 set_wiimote_rumble:  starts/stops rumble.  Pass in 1 to start, 0 to stop
 set_wiimote_ir:  starts/stops ir sensor.  Pass in 1 to start, 0 to stop

 get_wiimote_tilt_x
 get_wiimote_tilt_y
 get_wiimote_tilt_z

 get_wiimote_axis_x
 get_wiimote_axis_y
 get_wiimote_axis_z

 get_wiimote_ext_nunchuk_axis_x
 get_wiimote_ext_nunchuk_axis_y
 get_wiimote_ext_nunchuk_axis_z

 get_wiimote_ext_nunchuk_joyx
 get_wiimote_ext_nunchuk_joyy

 IR sensor position (must first set_wiimote_ir(1) to start ir sensor) NOT YET FINISHED:
 get_wiimote_ir1_y
 get_wiimote_ir1_x
 get_wiimote_ir1_size

 get_wiimote_ir2_y
 get_wiimote_ir2_x
 get_wiimote_ir2_size

 get_wiimote_ir3_y
 get_wiimote_ir3_x
 get_wiimote_ir3_size

 get_wiimote_ir4_y
 get_wiimote_ir4_x
 get_wiimote_ir4_size

 Methods below return 0 or 1 depending on if key is pressed:

 get_wiimote_keys_home
 get_wiimote_keys_minus
 get_wiimote_keys_a
 get_wiimote_keys_b
 get_wiimote_keys_1
 get_wiimote_keys_2
 get_wiimote_keys_plus
 get_wiimote_keys_up
 get_wiimote_keys_down
 get_wiimote_keys_right
 get_wiimote_keys_left
 get_wiimote_keys_bits

Example ^

 use Linux::Input::Wiimote;

 my $wii = new Linux::Input::Wiimote;

 $wii->wiimote_connect('00:19:1D:75:CC:30');

 while ( $wii->is_open() ) {
    $wii->wiimote_update();
    print "Wiimote Key bits: " . $wii->get_wiimote_keys_bits() . "\n";
 }

Todo ^

  Add support for multiple remotes (it is already in libcmote)
  Add auto descovery of wiimote 
  Add make test

Bugs ^

  wiimote_discover can cause a segfault

Author ^

   Chad Phillips chad@chadphillips.org http://www.windmeadow.com

License ^

 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
syntax highlighting: