Question/Issue:
The issue is to generate a signal from ESP32 CAM through GPIO Ports by detecting an object using a edge Impulse
Context/Use case:
There was no output since we cannot identify whether the signal is being generated
Steps Taken:
The code was written
The code was uploaded on ESP32 cam using arduino IDE
This is the code intialy that failed to send signals
#if EI_CLASSIFIER_OBJECT_DETECTION == 1
ei_printf(“Object detection bounding boxes:\r\n”);
// Reset all GPIO signals to LOW at the start of each frame
digitalWrite(RIGHT_TURN_GPIO, LOW);
digitalWrite(LEFT_TURN_GPIO, LOW);
digitalWrite(STOP_GPIO, LOW);
bool detected = false; // Flag to track if any valid detection occurs
for (uint32_t i = 0; i < result.bounding_boxes_count; i++) {
ei_impulse_result_bounding_box_t bb = result.bounding_boxes[i];
if (bb.value == 0) {
continue;
}
detected = true; // Set the flag if a bounding box is detected
ei_printf(" %s (%f) [ x: %u, y: %u, width: %u, height: %u ]\r\n",
bb.label,
bb.value,
bb.x,
bb.y,
bb.width,
bb.height);
// GPIO signal control based on bb.label
if (strcmp(bb.label, “right turn”) == 0) {
digitalWrite(RIGHT_TURN_GPIO, HIGH);
} else if (strcmp(bb.label, “left turn”) == 0) {
digitalWrite(LEFT_TURN_GPIO, HIGH);
} else if (strcmp(bb.label, “stop”) == 0) {
digitalWrite(STOP_GPIO, HIGH);
}
}
Expected Outcome:
We expected to see the value High on the digital trainer
Actual Outcome:
it showed nothing even though it detected an image
Reproducibility:
Always