Bb.label array implementation

Hello, I’m having problems with my Arduino code. To put it simply, I created an array defined as “char labels[10];” in my code then added an strcopy function to copy all the outputs from bb.label. Thereafter, I created a bool function to check through the array if all of its elements are strings “perishable_waste” or “nonperishable_waste” and then another bool to check if there is both. Lastly, I set a memset function at the beginning of the code which runs the classifier in order to set the array elements to null everytime the classifier runs again.

However, the code does not seem to work well and is dysfunctional. It detects the objects properly but the code never made an output from the array parts of the code. Assuming that I’ve never made any of that code, how do I create code that repeatedly checks all of the multiple outputs from bb.label everytime it runs the classifier then identifies whether all of the outputs are “perishable_waste”, “nonperishable_waste”, or mixed with both “perishable_waste” and “non perishable_waste”?

This EdgeImpulse example program shows how to loop over all the BB results (see lines 229 thru 252). In this example you would modify the else if statements with a both flag that gets evaluated outside the for-loop.

bool    gotNonperishable       = false;
bool    gotPerishable          = false;
uint8_t gotNonperishable_Count = 0;
uint8_t gotPerishable_Count    = 0;
for (size_t ix = 0; ix < EI_CLASSIFIER_LABEL_COUNT; ix++)
        if (result.classification[ix].label == "nonperishable_waste"
			gotNonperishable = true;
		else if (result.classification[ix].label == "perishable_waste"
			gotPerishable = true;
if (gotNonperishable && gotPerishable)
	// Got both.

hello @MMarcial , is the code inside the { } of “if (gotNotPerishable && got Perishable)” empty like you provided or does it still need to have some logic code provided inside?

Replace line // Got both. with your logic (for I have no idea what it is you are trying to accomplish).