How jarrydstringy/linefollower-pid-control works
PIDControl is firmware for an AVR line-following robot. On startup, the main loop calibrates sensor ranges until a button press, then detects markers and estimates line position, applies PD-based steering, adjusts speed on straights, and stops at a counted marker. Motor PWM setup and ADC initialization are delegated to small hardware modules. The excerpts show the controller reading ADC registers directly as well as the sensor module exposing a read helper; unsampled hardware wiring is not inferred.
Main entry points: PIDControl.c Main loop · Sensors.c ADC setup · Motors.c PWM setup
Components 11
Robot Control
- Main loop
PIDControl.c - Range calibration
PIDControl.c - Line position
PIDControl.c - Marker detection
PIDControl.c - PD steering
PIDControl.c
Sensor Input
- ADC setup
Sensors.c - Sensor reader
Sensors.c
Motor Output
- PWM setup
Motors.c
Other components
- Robot operator
- Eight line sensors
- Motor PWM outputs
Connections 16
- Robot operator → Main loop: starts
README.md - Main loop → Range calibration: calibrates
PIDControl.c - Main loop → ADC setup: initializes ADC
PIDControl.c - Main loop → PWM setup: sets up motors
PIDControl.c - Main loop → Marker detection: checks markers
PIDControl.c - Main loop → Line position: estimates position
PIDControl.c - Main loop → PD steering: applies correction
PIDControl.c - Main loop → Eight line sensors: reads ADC
PIDControl.c - Range calibration → Eight line sensors: samples ranges
PIDControl.c - Marker detection → Eight line sensors: samples sides
PIDControl.c - Line position → Eight line sensors: samples line
PIDControl.c - Sensor reader → Eight line sensors: reads ADC
Sensors.c - ADC setup → Eight line sensors: configures ADC
Sensors.c - PD steering → Motor PWM outputs: sets PWM
PIDControl.c - Main loop → Motor PWM outputs: stops motors
PIDControl.c - PWM setup → Motor PWM outputs: configures PWM
Motors.c