abc

Dependencies:   mbed pixy pixy_test

Fork of pixy_test by ese519

main.cpp

Committer:
jfields
Date:
2015-11-18
Revision:
0:6618ecb9567e
Child:
1:5302a23c97c4

File content as of revision 0:6618ecb9567e:

#include "mbed.h"
#include "Pixy.h"

Pixy pixy(Pixy::SPI, p11, p12, p13);
Serial pc(USBTX, USBRX);

int main() {
    pc.printf("ready\n\r");
    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);
                }
            }
        }
    } 
}