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.
main.cpp
- Committer:
- ZHAW_Prometheus
- Date:
- 2017-05-05
- Revision:
- 0:cb20dc12e879
File content as of revision 0:cb20dc12e879:
#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);
}
}