This simple hexapod robot can walk and reverse-turn using just one
motor. It can detect obstacles using the ultrasonic sensor.
programming is really simple: the robot steps forward until
the Ultrasonic Sensor measures detects a nearby object, then it reverse the motor direction and a
clever escapement mechanism allows the backward-turn maneuvre, driving
just one row of legs.
Here's the latch mechanism that does the trick: