A demo setup of the "Pan/Tilt Demo" code. This demo code uses the default setup of the Pixy servo motor control to follow Block 0 signature defined on the Pixy camera using the PixyMon software. Demo can be found here: https://www.youtube.com/watch?v=6D5IQyrFocU https://developer.mbed.org/users/swilkins8/notebook/cmucam5-pixy/

Dependencies:   mbed TPixy-Interface

main.cpp

Committer:
michelmoulin
Date:
2020-11-17
Revision:
1:b05954fae6d8
Parent:
0:886deae63aa3

File content as of revision 1:b05954fae6d8:


/* 17/11/20 : Ce pg affiche les coordonnées x et y du block détecté par la pixy */
#include "Pixy.h"

Serial serial(USBTX, USBRX);
SPI spi(PC_12, PC_11, PC_10); // mosi, miso, clk du SPI3
PixySPI pixy(&spi, &serial);

int main()
{
    uint16_t blocks;
    serial.printf("debut....\n\r");
    spi.frequency(1000000);
    while(1) 
    {
        serial.printf("nouvel essai : ");
        blocks = pixy.getBlocks();
        if (blocks) 
        {
               serial.printf("Detected %d : ", blocks);
               serial.printf("x=%d, y=%d \n\r",pixy.blocks[0].x,pixy.blocks[0].y);
        }
        wait(1);            
    }
}