Timon Willi / Mbed 2 deprecated PixyTest

Dependencies:   Pixy mbed

Files at this revision

API Documentation at this revision

Comitter:
ZHAW_Prometheus
Date:
Fri May 05 12:06:06 2017 +0000
Commit message:
Vers-0.1

Changed in this revision

Pixy.lib Show annotated file Show diff for this revision Revisions of this file
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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Pixy.lib	Fri May 05 12:06:06 2017 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/Prometheus/code/Pixy/#a2603d7fa0ac
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri May 05 12:06:06 2017 +0000
@@ -0,0 +1,40 @@
+#include "mbed.h"
+#include "Pixy.h"
+#include "cstdlib"
+
+Pixy pixy(Pixy::I2C, PB_9, PB_8);
+Serial pc(USBTX, USBRX);
+ 
+int main() {
+    wait(3);
+    //pc.printf("ready\n\r");
+    printf("ready\n\r");
+    
+    pixy.setSerialOutput(&pc);
+    while (1) {
+        //printf("while");
+        static int i = 0;
+        int j;
+        uint16_t blocks;
+  
+        blocks = pixy.getBlocks();
+  
+        if (blocks) {
+            i++;
+    
+            if (i % 50 == 0) {
+                //pc.printf("Detected %d:\n\r", blocks);
+                printf("Detected %d:\n\r", blocks);
+                for (j = 0; j < blocks; j++) {
+                    printf("  block %d: ", j);
+                    printf("sig: %d x: %d y: %d width: %d height: %d\n", pixy.blocks[j].signature, pixy.blocks[j].x, pixy.blocks[j].y, pixy.blocks[j].width, pixy.blocks[j].height);
+                    
+                    
+                    //pc.printf("  block %d: ", j);
+                    //pixy.blocks[j].print(pc);
+                }
+            }
+        }
+        wait( 0.01);
+    } 
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri May 05 12:06:06 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/ef9c61f8c49f
\ No newline at end of file