Changes

m
Robot: Cosmetic changes
Line 94: Line 94:  
switch(res) {
 
switch(res) {
 
case WPAD_ERR_NO_CONTROLLER:
 
case WPAD_ERR_NO_CONTROLLER:
printf(" Wiimote not connected\n");
+
printf(" Wiimote not connected\n");
 
break;
 
break;
 
case WPAD_ERR_NOT_READY:
 
case WPAD_ERR_NOT_READY:
printf(" Wiimote not ready\n");
+
printf(" Wiimote not ready\n");
 
break;
 
break;
 
case WPAD_ERR_NONE:
 
case WPAD_ERR_NONE:
printf(" Wiimote ready\n");
+
printf(" Wiimote ready\n");
 
break;
 
break;
 
default:
 
default:
printf(" Unknown Wimote state %d\n",res);
+
printf(" Unknown Wimote state %d\n",res);
 
 
 
}
 
}
printf(" Event count: %d\n",evctr);
+
printf(" Event count: %d\n",evctr);
 
if(res == WPAD_ERR_NONE) {
 
if(res == WPAD_ERR_NONE) {
 
wd = WPAD_Data(0);
 
wd = WPAD_Data(0);
printf(" Data->Err: %d\n",wd->err);
+
printf(" Data->Err: %d\n",wd->err);
printf(" IR Dots:\n");
+
printf(" IR Dots:\n");
 
for(i=0; i<4; i++) {
 
for(i=0; i<4; i++) {
 
if(wd->ir.dot[i].visible) {
 
if(wd->ir.dot[i].visible) {
printf("   %4d, %3d\n", wd->ir.dot[i].rx, wd->ir.dot[i].ry);
+
printf(" %4d, %3d\n", wd->ir.dot[i].rx, wd->ir.dot[i].ry);
 
} else {
 
} else {
printf("   None\n");
+
printf(" None\n");
 
}
 
}
 
}
 
}
 
if(wd->ir.valid) {
 
if(wd->ir.valid) {
printf(" Cursor: %.02f,%.02f\n",wd->ir.x, wd->ir.y);
+
printf(" Cursor: %.02f,%.02f\n",wd->ir.x, wd->ir.y);
printf("   @ %.02f deg\n",wd->ir.angle);
+
printf(" @ %.02f deg\n",wd->ir.angle);
 
} else {
 
} else {
printf(" No Cursor\n\n");
+
printf(" No Cursor\n\n");
 
}
 
}
 
if(wd->ir.raw_valid) {
 
if(wd->ir.raw_valid) {
printf(" Distance: %.02fm\n", wd->ir.z);
+
printf(" Distance: %.02fm\n", wd->ir.z);
printf(" Yaw: %.02f deg\n", wd->orient.yaw);
+
printf(" Yaw: %.02f deg\n", wd->orient.yaw);
 
} else {
 
} else {
 
printf("\n\n");
 
printf("\n\n");
 
}
 
}
printf(" Accel:\n");
+
printf(" Accel:\n");
printf("   XYZ: %3d,%3d,%3d\n",wd->accel.x,wd->accel.y,wd->accel.z);
+
printf(" XYZ: %3d,%3d,%3d\n",wd->accel.x,wd->accel.y,wd->accel.z);
printf("   Pitch: %.02f\n",wd->orient.pitch);
+
printf(" Pitch: %.02f\n",wd->orient.pitch);
printf("   Roll: %.02f\n",wd->orient.roll);
+
printf(" Roll: %.02f\n",wd->orient.roll);
printf(" Buttons down:\n   ");
+
printf(" Buttons down:\n ");
 
if(wd->btns_h & WPAD_BUTTON_A) printf("A ");
 
if(wd->btns_h & WPAD_BUTTON_A) printf("A ");
 
if(wd->btns_h & WPAD_BUTTON_B) printf("B ");
 
if(wd->btns_h & WPAD_BUTTON_B) printf("B ");
Line 142: Line 142:  
if(wd->btns_h & WPAD_BUTTON_HOME) printf("HOME ");
 
if(wd->btns_h & WPAD_BUTTON_HOME) printf("HOME ");
 
if(wd->btns_h & WPAD_BUTTON_PLUS) printf("PLUS ");
 
if(wd->btns_h & WPAD_BUTTON_PLUS) printf("PLUS ");
printf("\n   ");
+
printf("\n ");
 
if(wd->btns_h & WPAD_BUTTON_LEFT) printf("LEFT ");
 
if(wd->btns_h & WPAD_BUTTON_LEFT) printf("LEFT ");
 
if(wd->btns_h & WPAD_BUTTON_RIGHT) printf("RIGHT ");
 
if(wd->btns_h & WPAD_BUTTON_RIGHT) printf("RIGHT ");
Line 177: Line 177:  
</source>
 
</source>
   −
To make this example work, extra libraries must be linked in. Modify the standard Makefile LIBS line as follows:<br>
+
To make this example work, extra libraries must be linked in. Modify the standard Makefile LIBS line as follows:<br />
 
<code>LIBS := -lwiiuse -lbte -logc</code>
 
<code>LIBS := -lwiiuse -lbte -logc</code>
   −
On Mac OS X you will need to add <code>-lm</code> for libmath. On Mac OS X and Vista the order of the library flags is important, don't deviate from the above order otherwise you will get [http://www.tehskeen.com/forums/showthread.php?t=3012&page=3 strange errors] like:<br>
+
On Mac OS X you will need to add <code>-lm</code> for libmath. On Mac OS X and Vista the order of the library flags is important, don't deviate from the above order otherwise you will get [http://www.tehskeen.com/forums/showthread.php?t=3012&page=3 strange errors] like:<br />
 
<pre>C:/devkitpro/libogc/lib/wii/libbte.a(physbusif.o): In function 'physbusif_output':
 
<pre>C:/devkitpro/libogc/lib/wii/libbte.a(physbusif.o): In function 'physbusif_output':
physbusig.c: (.text.physbusif_output*0x148): undefined reference to 'USB_WriteBlkMsgAsync'</pre><br>
+
physbusig.c: (.text.physbusif_output*0x148): undefined reference to 'USB_WriteBlkMsgAsync'</pre><br />
   −
==See Also:==
+
== See Also: ==
 
* [[WiiMotionDemo]] ''accelerometer, GRRLIB''
 
* [[WiiMotionDemo]] ''accelerometer, GRRLIB''
 
* [[WiiMenu]]
 
* [[WiiMenu]]
1,189

edits