Datasheet

//---------------------------------------
Pixy pixy; // Declare the camera object
ServoLoop panLoop(200, 200); // Servo loop for pan
ServoLoop tiltLoop(150, 200); // Servo loop for tilt
ZumoMotors motors; // declare the motors on the zumo
//---------------------------------------
// Setup - runs once at startup
//---------------------------------------
void setup()
{
Serial.begin(9600);
Serial.print("Starting...\n");
pixy.init();
}
uint32_t lastBlockTime = 0;
//---------------------------------------
// Main loop - runs continuously after setup
//---------------------------------------
void loop()
{
uint16_t blocks;
blocks = pixy.getBlocks();
// If we have blocks in sight, track and follow them
if (blocks)
{
int trackedBlock = TrackBlock(blocks);
FollowBlock(trackedBlock);
lastBlockTime = millis();
}
else if (millis() - lastBlockTime > 100)
{
motors.setLeftSpeed(0);
motors.setRightSpeed(0);
ScanForBlocks();
}
}
int oldX, oldY, oldSignature;
//---------------------------------------