Program utama test puxt cmucam5 di stm32f446re

Dependencies:   mbed

Fork of PIXY_KRPAI_ITB by Achmad Fathoni

Files at this revision

API Documentation at this revision

Comitter:
achmad_fathoni
Date:
Sun Oct 29 07:06:42 2017 +0000
Parent:
2:85d539948111
Commit message:
Buat Johan

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
pixy.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 85d539948111 -r 070376242d2d main.cpp
--- a/main.cpp	Sun Apr 19 04:31:51 2015 +0000
+++ b/main.cpp	Sun Oct 29 07:06:42 2017 +0000
@@ -1,48 +1,31 @@
 #include "mbed.h"
 #include "Pixy.h"
 
-Pixy pixyL(Pixy::SPI, p11, p12, p13);
-Pixy pixyR(Pixy::SPI, p5, p6, p7);
+Pixy pixy(Pixy::SPI, PB_5, PB_4, PB_3);
 Serial pc(USBTX, USBRX);
 
-
 int main() {
-    pc.baud(115200);
-    pixyL.setSerialOutput(&pc);
-    pixyR.setSerialOutput(&pc);
+    pixy.setSerialOutput(&pc);
     pc.printf("Hello World!\n\r");
     while (1) {
+        wait(0.5);
         static int i = 0;
         int j;
         uint16_t blocks;
   
-        blocks = pixyL.getBlocks();
+        blocks = pixy.getBlocks();
   
         if (blocks) {
             i++;
-    
-                //pc.printf("Detected %d:\n\r", blocks);
-                //pc.printf("\n\r");
+                
+                pc.printf("Detected %d:\n\r", blocks);
+                pc.printf("\n\r");
                 for (j = 0; j < blocks; j++) {
-                 //   pc.printf("  block %d: \n\r", j);
-                    pixyL.blocks[j].print(pc);
+                    pc.printf("  block %d: \n\r", j);
+                    //pixy.blocks[j].print(pc);
+                    pc.printf("%d cm\n\r",pixy.blocks[j].width/6);
                 }
             
         }
-        
-        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
diff -r 85d539948111 -r 070376242d2d mbed.bld
--- a/mbed.bld	Sun Apr 19 04:31:51 2015 +0000
+++ b/mbed.bld	Sun Oct 29 07:06:42 2017 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/031413cf7a89
\ No newline at end of file
+https://mbed.org/users/mbed_official/code/mbed/builds/97feb9bacc10
\ No newline at end of file
diff -r 85d539948111 -r 070376242d2d pixy.lib
--- a/pixy.lib	Sun Apr 19 04:31:51 2015 +0000
+++ b/pixy.lib	Sun Oct 29 07:06:42 2017 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/users/CheeseW/code/pixy_hello/#703aa08663a0
+https://os.mbed.com/users/achmad_fathoni/code/pixy/#04e0865ad169