<< return to Pixycam.com

Printing/Saving Desired Coordinates of a coded block

Hi there,

I have recently started working with pixy through my Arduino. I am trying to get pixy to print only the x and y coordinates that are in a boundary.

Here is what I have so far;

#include <Wire.h>
#include <SPI.h>
#include <Pixy.h>

Pixy pixy;

void setup()
{
Serial.begin(9600);
pixy.init();

}

void loop()
{
if(pixy.getBlocks())
{
if(pixy.blocks[0].signature == 1);
int x=55;
for(x=50; x<100; x++){
Serial.print(pixy.blocks[0].x);
Serial.print("\t");
}
}
}

--------- But it prints all the coordinates for x no matter what.

Any suggestions?
Best,
Kash

Hello Kash,
It looks like you want to also print pixy.blocks[0].y (but you are only printing pixy.blocks[0].x)

This page has information on the available fields:

http://cmucam.org/projects/cmucam5/wiki/Arduino_API

Edward