3pi Robot Magnet Navigation Code

Замовник: AI | Опубліковано: 14.02.2026

I need a clean, well-commented Arduino sketch for the Pololu 3pi that lets the robot visit six preset locations, interact with the magnet at each spot, and return to its starting line in under four minutes. The only sensing method available is a magnetic sensor array, so all point detection and interaction logic must rely on that hardware. Two run modes have to coexist in the same program and be switchable through a simple flag, jumper, or serial command: • Intermediate – the robot must physically touch the magnet before leaving the point. • Difficult – the robot should recognise the magnetic field, stop just short of contact, and then continue. Between locations, I expect a mix of straight dashes and graceful curves; please handle path planning so the 3pi’s tight turning radius is respected and overall time stays below the four-minute cap. Deliverables 1. Fully commented .ino file ready to flash on a stock Pololu 3pi (ATmega328). 2. Brief read-me explaining pin assignments, sensor calibration steps, and how to switch between Intermediate and Difficult modes. 3. A concise test procedure I can follow to confirm: – all six magnets are found in sequence, – the correct interaction (touch vs. avoid) happens, – the robot returns to its start position before the four-minute mark. Use standard Arduino libraries only; no external dependencies beyond the magnetic sensors already on board.