<< return to Pixycam.com

How to retrieve coordinates on Arduino

Hi,

I am having trouble with my Arduino code. In short, if I have my PixyCam looking down, I want to know which “quadrant” my object is in. (really its just top half or bottom half). However, I can’t seem to find much information on the Wiki on how to do this. Here is a screenshot of some of the commands I found:

When using the “ccc_helloworld” example, I notice that the x/y coordinates do change when I move my object around, indicating that it is working, I just don’t know how to output that into a data structure I can use in a if/ else if statement. My end goal is to get an LED to light up if the object is “in the correct zone”.

Any tips or suggestions for this newbie would be greatly appreciated. I think computer vision is super cool and this is the start to a really cool project. Thanks again.

Hey there,

you’re on the right track - all you need to do is add your “if” statement into the “for” loop in the hello world code. You’ll be using the “if” to test the data you mentioned before - you can get at the x coordinates for example by using pixy.ccc.blocks[i].m_x

So something like

if (pixy.ccc.blocks[i].m_x > 100) {
 // do something
}

Hope this helps!

Cheers,
Jesse