<< return to Pixycam.com

LED if statement w/ Arduino and Pixy2

Hello,

I am trying to create an Ardunio code to work in my Pixy2. I want an LED to turn on once signature 1 is detected and then turn off if it is not detected. The current code I have will turn on the LED once the signature is detected by the Pixy, but it will not turn off afterward.

Any tips or advice would be greatly appreciated.

Figured it out if anyone in the future runs into this issue.

Hello,
Nice work getting it working, but I wanted to point out that your code

pixy.ccc.blocks[1].m_signature 

will only be valid if pixy.ccc.getBlocks() returns 2 or more blocks. That is pixy.ccc.blocks[1].m_signature is the 2nd block (the blocks count frrom 0 because it’s a C array).

https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:ccc_api

Edward