<< return to Pixycam.com

Documentation for functions


I’m doing a project where pixy2 is used to solve a maze by giving feedback on a ball’s current position in a maze. I was looking for some functions to set up the pixy2 from the C code (I’m using odroid-C4 with linux connected to pixy via usb). I found these functions using chatGPT but cannot find any sort of documentation. on the official website, the function calls are different to these. Does only one know if they will work for the original pixy2 firmware, if not is there some unofficial firmware that I can download?

#include <pixy.h>
int main()
// Initialize Pixy2 camera
int return_value = pixy_init();
if (return_value != 0)
// Error initializing Pixy2 camera
return return_value;

// Set line resolution to high
// Set line threshold to medium
// Set line detection ROI to the middle of the image
pixy_line_set_roi(160, 120, 480, 360);
// Enable line feature detection

// Set Pixy2 camera to detect lines

// Loop to continuously get line data from Pixy2 camera
while (1)
    // Get line data from Pixy2 camera
    int line_count = pixy_get_line_features();

    // Print line data to console
    for (int i = 0; i < line_count; i++)
        printf("Line %d: (%d, %d) (%d, %d)\n", i, pixy_line_features[i].x1, pixy_line_features[i].y1, pixy_line_features[i].x2, pixy_line_features[i].y2);



ChatGPT will make stuff up when it doesn’t know :slight_smile:

Here is the API for the line tracking:

There is no alternate firmware that I know about. The complete set of API’s can be found here: