Perl module for wiimote!
Submitted by chad on Tue, 2007-01-16 19:40
I wrote a perl module to interface with the wiimote. You can download the source here. It is fairly quick and dirty, but most of the wiimotes functions can be accessed by perl.
The axis, tilt, D-pad, keys, rumble, nunchuck joystick, nunchuck buttons and nunchuck tilt all work. The module accesses the C library, libcwiimote, that Joel Andersson wrote. Most of the real credit should go to him.
I have tested it on a laptop running Suse 10.0 with a USB bluetooth dongle. I got the dongle off ebay for $5.
lsusb lists my bluetooth dongle as:
Bus 002 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

I cant install it
cpan> install Linux::Input::Wiimote
Running install for module Linux::Input::Wiimote
Running make for T/TE/TEMPALTE/Linux-Input-Wiimote-0.03.tar.gz
Is already unwrapped into directory /root/.cpan/build/Linux-Input-Wiimote-0.03
Has already been processed within this session
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl5.8.8 "-Iblib/lib" "-Iblib/arch" test.pl
Can't load '/root/.cpan/build/Linux-Input-Wiimote-0.03/blib/arch/auto/Linux/Input/Wiimote/Wiimote.so' for module Linux::Input::Wiimote: /root/.cpan/build/Linux-Input-Wiimote-0.03/blib/arch/auto/Linux/Input/Wiimote/Wiimote.so: undefined symbol: wiimote_update at /usr/lib/perl5/5.8.8/i486-linux/DynaLoader.pm line 230.
at test.pl line 3
Compilation failed in require at test.pl line 3.
BEGIN failed--compilation aborted at test.pl line 3.
make: *** [test_dynamic] Error 9
Hack
I'm being hacked c:\Windows\winsxs\x86_microsoft-windows-musicsamples_31bf3856ad364e35_6.0.6000.16386_none_a81d9e66b53cd1c0ed with WMA "You may be right" - sending bluetooth to a cell phone in a very close range. CAn anyone help me get rid of this? I can't gain permissions to delete the WMA file or any of the .inf supporting files.
libcwiimote 0.4 and the perl module
Hi, it was great to find your module at CPAN. I'm playing with it since a day ago. I am having some problems trying to use some functions but I guess it can be because I am dinamically binding with version 0.4 instead of 0.3 of licwiimote. Have you tried with this version?
I was looking at the code and it seems to be just a DynaLoader wrapper (I'll read more about DynaLoader tonight), after that I was loking "fast" the libcwiimote code but stoped to ask you if you are planning to update de perl module. I also got some functionality from the source, maybe I can try to document it while I'm using it.
I'm making an event module on top of your module, so it is pretty important for me to get the base module fully functional. My code is on early stages but it can bind to some events now. I'll send you the code if you like.
I have only tried it against
I have only tried it against version 0.3. You are right, that it is just a wrapper, so it should be easy to get to work against version .4.
I haven't done much with the code lately. If you are anyone else would like to take ownership of the perl module, that would be cool with me.
thanks
chad
wiimote documentation
when i got the example scripts they were not working
i went through wiimote.pm and found the proper function calls
i also couldn't find too much about it on the net
i put together a test script that runs through most of the functions
http://www.shyft.us/projects/wiimote/info.html
http://www.shyft.us/projects/wiimote/wiitest.perl
its not too detailed but it should give those interested a basic idea of how to get started.
thanks for your initial work,
-shyft
I'm playing arround version 0.4
Well, I'm having some pleasure playing around with perl and the wiimote. I'm adding more wrappers and will try to fix the ones that exists but doesn't work (like rumble). As I am doing this on weekend I wont take ownership till I got a new version working well.
I'll try to post here while I'm doing some advance to keep this in one point till a probably release :)
Sound this ok to you?
Thanks to you!
Diego
IR
Does the infrared work for you? I'm having problems with the latest libwiimote; I always get the same (bogus) values for IR.
I'll try it tonight and post
I'll try it tonight and post back.
re: Namespacs
I just re-loaded the file. The namespace is now Linux::Input::Wimote. I also put it in cpan. My tarball on this site also includes libcwiimote, so you may want to use it instead of the cpan version. If you have any suggestions/comments I would love to here them.
You can also go to http://sourceforge.net/projects/libwiimote/ to ask questions about libcwiimote. My perl module is basically just a frontend to that library.
thanks
chad
Namespaces
Would you consider giving the module a bit of a longer name for the 0.2 release? Top-level 'Wiimote' just doesn't seem right. Maybe Input::Wiimote?
-Andrew
Post new comment