r1 - 22 Jan 2010 - 16:37:39 - SatoshiKonnoYou are here: TWiki >  Main Web > OssHome > VrDeviceDriver > WiimoteForCC
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 the document how to use the library in more detail smile

Topic attachments
I Attachment Action Size Date Who Comment
jpgjpg wiimotedemo.jpg manage 82.5 K 22 Jan 2010 - 16:30 SatoshiKonno  
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r1 | More topic actions
 
Powered by TWiki
Copyright © 2010 by Satoshi Konno Powerd by twikiTWiki.