Vizible’s Blog

Perl – Test Linux::Input::Wiimote

Posted in perl by wearetherock on July 26, 2009

1. Install
=====================================

$ sudo apt-get instsall libcwiimote-0.2  libcwiimote-dev  
$ perl -MCPAN -e shell
cpan > install Linux::Input::Wiimote

~
2. Test
=====================================

$ lswm 
Put Wiimotes in discoverable mode now (press 1+2)...
00:1E:35:CB:32:13

~
3. Coding
=====================================

use Linux::Input::Wiimote;
my $wii = new Linux::Input::Wiimote;
$wii->wiimote_connect('00:1E:35:CB:32:13');
while ( $wii->is_open() ) {
    $wii->wiimote_update();
    print "Wiimote Key bits: " . $wii->get_wiimote_keys_bits() . "\n";
}

~
4. Output (Error)
=====================================

[!] Runtime error: Can't locate auto/Linux/Input/Wiimote/is_open.al in @INC
(@INC contains: /etc/perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0
/usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10
/usr/local/lib/site_perl .) at (eval 13) line 4

  4.1 haven't is_open() method ? (yes see : methods).
  4.2 not understand why module example use this method.
~
Advertisements

2 Responses

Subscribe to comments with RSS.

  1. wearetherock said, on July 26, 2009 at 4:09 pm

    check connection stat instead
    $conn = $wiimote_connect(’00:19:1D:75:CC:30′);
    while($conn == 0 ) { do… }

    $conn == 0 mean connecting is success

  2. wearetherock said, on July 26, 2009 at 4:14 pm

    testing result (will verify later for each key bits format)
    $ perl TestWiimote.pl
    0Wiimote Key bits: 0000000000000000
    Wiimote Key bits: 0000000000000000
    Wiimote Key bits: 0000000000001000
    Wiimote Key bits: 0000000000000000
    Wiimote Key bits: 0000010000000010
    Wiimote Key bits: 0000010000000000
    Wiimote Key bits: 0000000000000000
    Wiimote Key bits: 0000000000000001
    Wiimote Key bits: 0000000000000000
    Wiimote Key bits: 0000000000000100
    Wiimote Key bits: 0000000000000000
    Wiimote Key bits: 0000000000001000
    Wiimote Key bits: 0000000000000000
    Wiimote Key bits: 0000010000000000
    Wiimote Key bits: 0000000000000000
    Wiimote Key bits: 0000001000000000
    Wiimote Key bits: 0000000000000000
    Wiimote Key bits: 0000000100000000
    Wiimote Key bits: 0000000100010000
    Wiimote Key bits: 0000000000010000
    Wiimote Key bits: 0000000000000000
    Wiimote Key bits: 1000000000000000
    Wiimote Key bits: 0000000000000000
    Wiimote Key bits: 0001000000000000
    Wiimote Key bits: 0000000000000000
    Wiimote Key bits: 0000000000001000
    Wiimote Key bits: 0000000000000000


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: