<< return to Pixycam.com

Recognize a signature


#1

Hi,
The goal of my program is to count 2 differents values thanks to 2 differents signatures (1 and 2) but the problem is that it doesn’t recognize any signature. Could you help me to fix up my program. Here it is :
int sigCan = 1;
int sigGob = 2;
int c;
int g;
Pixy2 pixy;
int8_t setLamp();
uint8_t getBlocks;
void setup()
{
Serial.begin(115200);
Serial.print(“Starting…\n”);
pixy.init();
}

void loop()
{

int i;
uint16_t m_signature;
uint16_t blocks;
pixy.setLamp(1,0);
pixy.ccc.getBlocks();
blocks = pixy.ccc.getBlocks();

    Serial.println();
    Serial.print("Canette");
    Serial.print(":");
    Serial.print(c);
    Serial.println();

    Serial.println();
    Serial.print("Gobelet");
    Serial.print(":");
    Serial.print(g);
    Serial.println();
   
   
   if (blocks)
   {
    for(i=0; i<blocks; i++)
    {
      if (m_signature == 1)
      {
   c == c++;    
      }
       else if (m_signature == 2)
       {
     g == g++;
       }
      }
   }

#2

Hi,

it looks like you’re not referencing the values correctly - first, delete the line blocks = pixy.ccc.getBlocks(); as it is superfluous.

Instead of if (blocks), use
if (pixy.ccc.numBlocks)
(and change your for loop accordingly)

Instead of if (m_signature == 1), use
if (pixy.ccc.blocks[i].m_signature == 1)

Hope this helps!

Cheers,
Jesse