Navigate maze with distance sensor: look right, left or behind

Опубликовано: 13 Июль 2026
на канале: Coding & Robotics
2,468
29

Coding mazes is great fun and tests your flow control coding skills.

For a previous maze project, the robot itself turned to look to see there was space to go forward.

But what if the sensor does the turning? I was inspired by this video    • Maze Solving Lego EV3 Robot   to turn the ultrasonic sensor instead of the robot when it checks the distance. My robot must look left, right or behind; go forwards if there is space; stop at the pink square. Feedback on the robot's navigation and move attempts are displayed on the light matrix.

For a robot, I modified the Driver Base by using its large motor to drive an ultrasonic sensor that could turn.

Then I was inspired by this maze-solving robot    • Lego Mindstorm EV3 Robot to Find Path and ...  , which also shoots balls while it navigates the maze. My robot can't throw, but it can push. So if the robot sees green, it turns 180 and bumps a wall block over and carries on.


Useful links
Driving Base build instructions: https://education.lego.com/en-us/prod...
Turning ultrasonic sensor maze-solving robot:    • Maze Solving Lego EV3 Robot  
A maze-solving robot that also throws balls:    • Lego Mindstorm EV3 Robot to Find Path and ...  
Foam blocks: PE 45 medium density foam: https://www.ifoam.co.za (Cape Town)