no, I’m not using many Arduinos all at once - why do think I’d do?
Of course I started by hello_world: I mentioned that several times!
But I can’t clearaly see, at what time I’m receiving signature data and when - which - colorcode data.
Addionally there seem to be cc issues about the current FW.
this is my code - it displays the block data on a local TFT .
Just tell me how to insert 1 line or 2, how to identify cc IDs and cc (x,y) block positions:
// pixy-cam LCDTFT monitoring program
// pixyTFTSPI
// Pixy Cam connected by SPI
// version 0008
#include
#include
#include
// UTFT myGLCD(Model,SDA,SCL,CS,RST,RS)
// adjust the model parameter to suit the display module!
UTFT myGLCD(QD220A,43,42,41,0,40);
extern uint8_t SmallFont[];
uint8_t ScrRatio;
Pixy pixy;
void setup()
{
myGLCD.InitLCD();
myGLCD.setFont(SmallFont);
pixy.init();
//pixy.blocks[i].x The x location of the center of the detected object (0 to 319)
//pixy.blocks[i].y The y location of the center of the detected object (0 to 199)
// Pixy_maxSize/(GLCD_maxSize-frame)
ScrRatio=max(320/(myGLCD.getDisplayXSize()-20), 200/(myGLCD.getDisplayYSize()-20) )+1;
myGLCD.clrScr();
Serial.begin(19200);
}
uint16_t sigcolor( uint8_t signature) { // <<<<<<<<<<<<<<< customize !! <<<<<<<<<<
uint16_t color;
if(signature==1) color=VGA_RED; // light red
else
if(signature==2) color=VGA_AQUA; // light blue
else
if(signature==3) color=VGA_YELLOW; // just yellow ;)
else
if(signature==4) color=VGA_LIME; // light green
else
if(signature==5) color=VGA_FUCHSIA; // light pink
else
if(signature==6) color=VGA_BLUE; // dark blue
else
if(signature==7) color=VGA_PURPLE; // dark pink
else
color=VGA_WHITE;
return color;
}
char sbuf[240];
#define maxblocks 64
uint8_t blockS[maxblocks];
uint8_t blockX[maxblocks];
uint8_t blockY[maxblocks];
uint8_t blockW[maxblocks];
uint8_t blockH[maxblocks];
void loop()
{
static int i = 0;
int j;
uint16_t nblocks;
uint8_t x1,y1,x2,y2;
nblocks = pixy.getBlocks();
if (nblocks)
{
i++;
if (i % 10==0)
{
myGLCD.clrScr();
sprintf(sbuf, "Detected %d:\n", nblocks);
Serial.print(sbuf);
for (j=0; j<min(nblocks,maxblocks); j++)
{
sprintf(sbuf, " block %d: ", j);
Serial.print(sbuf);
pixy.blocks[j].print();
blockS[j]= pixy.blocks[j].signature;
blockX[j]= pixy.blocks[j].x;
blockY[j]= pixy.blocks[j].y;
blockW[j]= pixy.blocks[j].width;
blockH[j]= pixy.blocks[j].height;
myGLCD.setColor(sigcolor(blockS[j])); myGLCD.setBackColor(VGA_BLACK);
x1=blockX[j]-blockW[j]/2;
x2=blockX[j]+blockW[j]/2;
y1=blockY[j]-blockH[j]/2;
y2=blockY[j]+blockH[j]/2;
myGLCD.drawRect(x1/ScrRatio, y1/ScrRatio, x2/ScrRatio, y2/ScrRatio );
sprintf(sbuf, "%d", blockS[j]);
myGLCD.print(sbuf, (x1+10)/ScrRatio,(y1+10)/ScrRatio);
}
}
}
}