This is my current code
I’ll flow through the code to help you:
Let’s assume that there is an object found:
Object Detected? Yes.
Then Drive Forward
Object not detected? No.
(not ran) Stop Driving
However, if there is no object found:
Object Detected? No.
(not ran) Drive Forward
(Consequently also not ran) Objected not detected? No.
(not ran) Stop Driving
The issue is that the code needs to detect an object in order for it to test if it’s not detecting.
Instead, you can use an if/else block:
3 Likes