Program utama test puxt cmucam5 di stm32f446re

Dependencies:   mbed

Fork of PIXY_KRPAI_ITB by Achmad Fathoni

Revision:
1:97221820a967
Parent:
0:63532ae95efe
Child:
3:070376242d2d
--- a/main.cpp	Sun Nov 16 11:54:19 2014 +0000
+++ b/main.cpp	Sun Apr 19 04:29:21 2015 +0000
@@ -1,28 +1,48 @@
 #include "mbed.h"
 #include "Pixy.h"
 
-Pixy pixy(Pixy::SPI, D11, D12, D13);
+Pixy pixyL(Pixy::SPI, p11, p12, p13);
+Pixy pixyR(Pixy::SPI, p5, p6, p7);
 Serial pc(USBTX, USBRX);
 
+
 int main() {
-    pixy.setSerialOutput(&pc);
+    pc.baud(115200);
+    pixyL.setSerialOutput(&pc);
+    pixyR.setSerialOutput(&pc);
+    pc.printf("Hello World!\n\r");
     while (1) {
         static int i = 0;
         int j;
         uint16_t blocks;
   
-        blocks = pixy.getBlocks();
+        blocks = pixyL.getBlocks();
   
         if (blocks) {
             i++;
     
-            if (i % 50 == 0) {
-                pc.printf("Detected %d:\n\r", blocks);
+                //pc.printf("Detected %d:\n\r", blocks);
+                //pc.printf("\n\r");
                 for (j = 0; j < blocks; j++) {
-                    pc.printf("  block %d: ", j);
-                    pixy.blocks[j].print(pc);
+                 //   pc.printf("  block %d: \n\r", j);
+                    pixyL.blocks[j].print(pc);
                 }
-            }
+            
         }
+        
+        blocks = pixyR.getBlocks();
+  
+        if (blocks) {
+            i++;
+    
+                //pc.printf("Detected %d:\n\r", blocks);
+                //pc.printf("\n\r");
+                for (j = 0; j < blocks; j++) {
+                 //   pc.printf("  block %d: \n\r", j);
+                    pixyR.blocks[j].print(pc);
+                }
+            
+        }
+        pc.printf("\n\r");
     }  
 }
\ No newline at end of file