Wii Motion Plus (compatible) simple test program for WiiMP library

Dependencies:   mbed

main.cpp

Committer:
gbrush
Date:
2011-03-14
Revision:
0:45587cf98aa5

File content as of revision 0:45587cf98aa5:

#include "mbed.h"

#include "WiiMP.h"

WiiMP WiiMPlus(p9, p10);
Serial pc(USBTX, USBRX);

int main() {


         pc.baud(115200);
         pc.printf("wii test begin                                             \r\n");

         int Yaw = 0; int Roll = 0;
         int Pitch = 0;
         
     
      while(1) {
         bool read = WiiMPlus.Read(&Yaw,&Roll,&Pitch);
         if(read)
         {
             pc.printf("Y:%d R:%d P:%d                    \r", Yaw, Roll, Pitch);
         }
         else
         {
             pc.printf("Error\n");
         }
         wait(0.001);
     }
 }