Hello, I am a student that is relatively new to coding with an Arduino combined with the pixy camera, so I’m not sure if this question has been answered already or not. I currently have a code similar to the one below (I am not able to share my exact code, so this was borrowed from another forum post that was linked at the bottom). I have tried to implement if statements nested within the for loop so that my robot will do a specific task based on the block that the pixy recognizes. However, when I try to use the pixy.ccc.blocks[i].m_signature command and print the signatures, the first block in the frame (regardless of color) outputs as a signature zero. When there are 2 blocks in the frame, it outputs a zero and a one, and so on. I want to be able to have each block associated with a specific number so I can use an if statement similar to…
“if (pixy.ccc.blocks[i].m_signature == 1)” and “if (pixy.ccc.blocks[i].m_signature == 2)” , etc.
I would appreciate any help, and if this is confusing, I can try to explain using my whole code once I figure out how to upload it on the forums correctly.
// grab blocks!
// If there are detect blocks, print them!
for (i=0; i<pixy.ccc.numBlocks; i++)
Serial.print(” block “);
Credit: Edge (Edward)