From what I understand pixy.getBlocks returns the number of blocks found. However, returning 0 could mean 0 blocks found or no new blocks available since the last call. Before I realized this, this was causing me problems as I was trying something along these lines:
while(1) { blocks=pixy.getBlocks() if (blocks >0) { do some stuff if pixy sees what we want...... } else { do some stuff if pixy doesnt see what we are looking for } }
However, it was not behaving as expected as blocks being equal to 0 could also mean no new frames available. The fix was easy, I simply put a delay in the loop to make sure the call to getBlocks() never executes more than 50 times per second.
However, is there an easy way to tell if a 0 returned means 0 blocks found or no new data?