Hello, I'm pretty new with arduino I'm trying to replicate this project for the pixy camera and I'm trying to use this code exactly:
#include <SPI.h>
#include <Pixy.h>
Pixy pixy;
void setup()
{
Serial.begin(9600);
Serial.print("Starting...\n");
pixy.init();
}
void loop()
{
uint16_t type;
static int i = 0;
int j;
int16_t signature;
int16_t angle;
uint16_t blocks;
blocks = pixy.getBlocks();
if (blocks)
{
i++; //<<<<< ----- Delay each 50 Loops everi 50 loop go in
if (i % 50 == 0) //<<<<< ----- Delay each 50 Loops everi 50 loop go in
{
Serial.print("Detected :");
Serial.print(blocks);
Serial.print("\n");
for (j = 0; j < blocks; j++)
{
Serial.print("type =");
Serial.print(pixy.blocks[j].type);
Serial.print("\t");
Serial.print("Sign =");
signature = (pixy.blocks[j].signature);
Serial.print(signature,OCT);
Serial.print("\t");
Serial.print("Loc X =");
Serial.print(pixy.blocks[j].x);
Serial.print("\t");
Serial.print("Loc Y =");
Serial.print(pixy.blocks[j].y);
Serial.print("\t");
Serial.print("width =");
Serial.print(pixy.blocks[j].width);
Serial.print("\t");
Serial.print("Height =");
Serial.print(pixy.blocks[j].height);
Serial.print("\t");
Serial.print("angle =");
angle = (pixy.blocks[j].angle);
Serial.print(angle);
Serial.print("\t");
pixy.blocks[j].print(); //<<<----- This print all one Line
}
Serial.print("\n\n");
}
}
}
But I keep getting the error:
'struct Block' has no member named 'type'
And it always points to this line
Serial.print(pixy.blocks[j].type);
I'm not sure what I'm doing wrong, I made sure the arduino was working fine and the Pixy camera itself works fine and the servos are all working fine individually. And I didn't change anything when I copy and pasted the code. Any help would be appreciated please and thank you.
-Psaro