Summary
You have built a robot that drives on its own — and it has no program. Its whole «behaviour» is a few formulas, and you derived each one from what the robot has to do:
- the manoeuvre — the steps of the CD4017 counter: forward → back 0.4 s → turn 0.4 s → forward;
- wait for a bump —
HOLD=NOR(NFWD,TRIP): the counter stands on step 0 until there is a reason; - the wheels —
LDIR=NOT BACK,RDIR=NOR(BACK,TURN); - centimetres — 8 kHz ticks while the echo is on: 1 tick — 1 cm; stop at 99; the number into a register so the display does not flicker;
- close — tens < 2 (CD4585), latched at the show step;
- a reason for the manoeuvre —
TRIP=HITORNEAR; - along the line — a wheel turns as long as its sensor does not see the line:
LON=NOR(SL,NGO).
What next
- Change the threshold:
Bof the CD4585 = 3 — the robot turns at 30 cm,B= 1 — at 10. - Swap
LDIRandRDIRon the chassis — the robot turns anticlockwise. - Draw your own track with the mouse — one closed line, smooth turns, no crossings.
- Put a second robot in the same arena: the ultrasound sees another robot's body too.