<< return to Pixycam.com

Port pixy code to work with pixy2


I have code that works with the Pixy camera that I want to port to work with the Pixy2 camera. My old Pixy code referenced “pixy.h”. I see on the web there is a “pixy2.h” but that file is not in my pixy2 directory that I cloned from : git clone https://github.com/charmedlabs/pixy2.git.

Should I have installed something else?

By the way, I’m running PixyMon on my Raspberry Pi and it’s working fine.


You have the correct respository. Was pixy.h part of libpixyusb? If so, libpixyusb has been rewritten and is now libpixyusb2. Our apologies for the changes, but the new code is much easier to maintain and expand.




Ok, so there is no porting guide. I’ve already started going through one of the Pixy2 examples and comparing the old code to the new code to figure out what I have to change.

Thanks for the help.



There use to be:

// Pixy x-y position values
#define PIXY_MIN_X 0
#define PIXY_MAX_X 319
#define PIXY_MIN_Y 0
#define PIXY_MAX_Y 199

Any idea what the settings are for the camera minx and maxx are now?


With Pixy2 these values depend on the program that Pixy is running, so the width and height are part of the API. Call getResolution():