Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 0:cb20dc12e879
--- /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