I have released the C++ library for Wiimote. I would like to release the library for any platforms such as Linux and MacOSX finally, but I have released it only for WIN32 platforms at the first release. Please chceck the download site on SourceForge.net to get the package and the samples.

wiimotedemo.jpg

The package includes the most simple sample which outputs data of a Wiimore to the standard console. The main source code is the following.

#include <stdio.h>
#include <cybergarage/wii/Wiimote.h>
using namespace CyberGarage;
int main( int argc, char *argv[] )
{
 Wiimote *wiimote;
 wiimote = new Wiimote();
 if (wiimote->open() == false) {
  delete wiimote;
  printf(";Could not find Wiimote !!";);
  return 0;
 }
 do {
  wiimote->read();
  printf(";\r%+d %+d %+d %s %s %s %s %s %s %s %s %s %s %s";,
   (wiimote->getXMotion()-0x80),
   (wiimote->getYMotion()-0x80),
   (wiimote->getZMotion()-0x80),
   (wiimote->IsAPressed() ? ";A"; : "; ";),
   (wiimote->IsBPressed() ? ";B"; : "; ";),
   (wiimote->IsOnePressed() ? ";1"; : "; ";),
   (wiimote->IsTwoPressed() ? ";2"; : "; ";),
   (wiimote->IsUpPressed() ? ";U"; : "; ";),
   (wiimote->IsDownPressed() ? ";D"; : "; ";),
   (wiimote->IsLeftPressed() ? ";L"; : "; ";),
   (wiimote->IsRightPressed() ? ";R"; : "; ";),
   (wiimote->IsMinusPressed() ? ";-"; : "; ";),
   (wiimote->IsPlusPressed() ? ";+"; : "; ";),
   (wiimote->IsHomePressed() ? ";H"; : "; ";)
   );
  Sleep(100);
 } while (wiimote->IsHomePressed() == false);
 wiimote->close();
 delete wiimote;
 return 0;
}

Please check Wiimote for C++ User’s Guide how to use the library in more detail smile

Topic attachments
I Attachment Action Size Date Who Comment
JPEGjpg wiimotedemo.jpg manage 82.5 K 2010-01-22 - 16:30 SatoshiKonno  
Topic revision: r2 - 2011-04-10 - 14:17:56 - SatoshiKonno
 

Copyright © 2012 by Satoshi Konno Powerd by TWiki logoTWiki.