Wiimote IR Camera test program, adapted from kako\'s source: http://www.kako.com/neta/2008-009/2008-009.html Generates ~20MHz clock signal for camera using PWM on p21. Communicates with camera via I2C on p9, p10. Schematic: {{http://lh4.ggpht.com/_59HHJuZw_Rk/TRxBhT0q6iI/AAAAAAAABq8/_dlbN1rIQb4/s912/mbed_schematic.jpg|600|400}} [[http://code.google.com/p/wii-cam-blobtrack/|Java GUI]] [[http://www.bot-thoughts.com/2010/12/connecting-mbed-to-wiimote-ir-camera.html|Interfacing Details]]

Dependencies:   mbed

Revision:
1:150525e9c21f
Parent:
0:cf1bc7c313b4
--- a/main.cpp	Thu Dec 30 07:50:11 2010 +0000
+++ b/main.cpp	Fri Dec 31 09:33:30 2010 +0000
@@ -6,6 +6,10 @@
 // obviously mbed is 3.3v so no level translation is needed
 // using built in i2c on pins 9/10
 //
+// PC GUI client here: http://code.google.com/p/wii-cam-blobtrack/
+//
+// Interfacing details here: http://www.bot-thoughts.com/2010/12/connecting-mbed-to-wiimote-ir-camera.html
+//
 
 DigitalOut myled(LED1);
 PwmOut servo(p21);
@@ -39,7 +43,6 @@
 {
     // Init IR Camera sensor
     i2c_write2(addr, 0x30, 0x01);
-    pc.printf("+\n");
     i2c_write2(addr, 0x30, 0x08);    
     i2c_write2(addr, 0x06, 0x90);
     i2c_write2(addr, 0x08, 0xC0);
@@ -59,11 +62,11 @@
     
     // PC serial output    
     pc.baud(115200);
-    pc.printf("Initializing camera...");
+    //pc.printf("Initializing camera...");
 
     cam_init();
   
-    pc.printf("complete\n");
+    //pc.printf("complete\n");
 
     // read I2C stuff
     while(1) {
@@ -100,10 +103,11 @@
         Iy4 += (s & 0xC0) <<2;
         
         // print the coordinate data
-        pc.printf("Ix1: %4d, Iy1: %4d\n", Ix1, Iy1 );
-        pc.printf("Ix2: %4d, Iy2: %4d\n", Ix2, Iy2 );
+        //pc.printf("Ix1: %4d, Iy1: %4d\n", Ix1, Iy1 );
+        //pc.printf("Ix2: %4d, Iy2: %4d\n", Ix2, Iy2 );
+        pc.printf("%d,%d,%d,%d,%d,%d,%d,%d\r\n", Ix1, Iy1, Ix2, Iy2, Ix3, Iy3, Ix4, Iy4);
         
-        wait(0.250);
+        wait(0.050);
     }
 
 }