An adapted example of the Arduino Pixy Hello World demo

Dependencies:   mbed pixy

Files at this revision

API Documentation at this revision

Comitter:
acracan
Date:
Sun Nov 16 11:54:19 2014 +0000
Commit message:
Pixy hello world example.

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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Nov 16 11:54:19 2014 +0000
@@ -0,0 +1,28 @@
+#include "mbed.h"
+#include "Pixy.h"
+
+Pixy pixy(Pixy::SPI, D11, D12, D13);
+Serial pc(USBTX, USBRX);
+
+int main() {
+    pixy.setSerialOutput(&pc);
+    while (1) {
+        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);
+                for (j = 0; j < blocks; j++) {
+                    pc.printf("  block %d: ", j);
+                    pixy.blocks[j].print(pc);
+                }
+            }
+        }
+    }  
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Nov 16 11:54:19 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/031413cf7a89
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pixy.lib	Sun Nov 16 11:54:19 2014 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/acracan/code/pixy/#ed8dc4531ac1