I’ve been working on a code that uses a Pixy camera to move an eye on a gimble and track a target. When it loses the target, it returns the eye to the center looking forward. The problem I’m having is that the Pixy doesn’t detect continuously and therefore has false negatives between each detection. (see picture attached the of serial monitor showing several false negatives between each detection)
In order to avoid the eye attempting to return during these false negatives, I’m wanting to include a timer so that the eye only tries to return to the center after the target has been lost for 1 second. I’ve been trying to use millis() to act as a timer, but the closest I’ve gotten is the eye tracking the target and trying to return to center every 1 second.
Any suggestions? Thanks in advance.
pixy_and_eye_xy_return_test.ino (1.72 KB)