Hi,
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
pixy_line_set_resolution(2);
// Set line threshold to medium
pixy_line_set_threshold(50);
// Set line detection ROI to the middle of the image
pixy_line_set_roi(160, 120, 480, 360);
// Enable line feature detection
pixy_line_set_features(true);
// Set Pixy2 camera to detect lines
pixy_line_get_main_features();
// 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);
}
}
}
Thanks,
Michael.