# liyafpv/linefollower32 architecture

> Architecture diagram of the GitHub repository liyafpv/linefollower32, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/liyafpv/linefollower32
- Repository: https://github.com/liyafpv/linefollower32

## Overview

This repository’s application is an embedded line-following robot. Its main workflow initializes hardware and restores settings, then responds to a start button by reading the line, calculating a steering correction, and driving the motors; Bluetooth is serviced by the main loop. The sampled code shows the main control and EEPROM persistence, but not the implementations of the sensor, PID, motor, or Bluetooth modules, so their internal behavior and some calls remain unverified.

Main entry points: [`src/main.cpp`](https://github.com/liyafpv/linefollower32/blob/main/src/main.cpp) (Control loop), [`src/bluetooth.cpp`](https://github.com/liyafpv/linefollower32/blob/main/src/bluetooth.cpp) (Bluetooth control), [`src/sensors.cpp`](https://github.com/liyafpv/linefollower32/blob/main/src/sensors.cpp) (Line sensing), [`src/pid.cpp`](https://github.com/liyafpv/linefollower32/blob/main/src/pid.cpp) (PID correction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Robot control"]
  node_main["Control loop<br/>[main.cpp]"]
  node_sensors["Line sensing<br/>[sensors.cpp]"]
  node_pid["PID correction<br/>[pid.cpp]"]
  node_motors["Motor drive<br/>[motors.cpp]"]
end

subgraph group_interfaces["User interfaces"]
  node_bluetooth["Bluetooth control<br/>[bluetooth.cpp]"]
end

subgraph group_state["Persistent settings"]
  node_settings["Settings state<br/>[main.cpp]"]
  node_eeprom[("EEPROM")]
end

node_operator(("Operator"))

node_operator -->|"starts robot"| node_main
node_main -->|"reads line"| node_sensors
node_main -.->|"gets correction"| node_pid
node_main -->|"sets speed"| node_motors
node_main -->|"services Bluetooth"| node_bluetooth
node_bluetooth -.->|"accepts commands"| node_operator
node_main -->|"loads and saves"| node_settings
node_settings -->|"reads and writes"| node_eeprom

click node_main "https://github.com/liyafpv/linefollower32/blob/main/src/main.cpp"
click node_sensors "https://github.com/liyafpv/linefollower32/blob/main/src/sensors.cpp"
click node_pid "https://github.com/liyafpv/linefollower32/blob/main/src/pid.cpp"
click node_motors "https://github.com/liyafpv/linefollower32/blob/main/src/motors.cpp"
click node_bluetooth "https://github.com/liyafpv/linefollower32/blob/main/src/bluetooth.cpp"
click node_settings "https://github.com/liyafpv/linefollower32/blob/main/src/main.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_sensors,node_pid,node_motors toneBlue
class node_bluetooth toneAmber
class node_settings,node_eeprom toneMint
class node_operator toneIndigo
```

## Components

### Robot control

- [Control loop](https://github.com/liyafpv/linefollower32/blob/main/src/main.cpp): `src/main.cpp`
- [Line sensing](https://github.com/liyafpv/linefollower32/blob/main/src/sensors.cpp): `src/sensors.cpp`
- [PID correction](https://github.com/liyafpv/linefollower32/blob/main/src/pid.cpp): `src/pid.cpp`
- [Motor drive](https://github.com/liyafpv/linefollower32/blob/main/src/motors.cpp): `src/motors.cpp`

### User interfaces

- [Bluetooth control](https://github.com/liyafpv/linefollower32/blob/main/src/bluetooth.cpp): `src/bluetooth.cpp`

### Persistent settings

- [Settings state](https://github.com/liyafpv/linefollower32/blob/main/src/main.cpp): `src/main.cpp`
- **EEPROM**

### Other components

- **Operator**

## Connections

- Operator → Control loop: starts robot (evidence: `src/main.cpp`)
- Control loop → Line sensing: reads line (evidence: `src/main.cpp`)
- Control loop → PID correction: gets correction
- Control loop → Motor drive: sets speed (evidence: `src/main.cpp`)
- Control loop → Bluetooth control: services Bluetooth (evidence: `src/main.cpp`)
- Bluetooth control → Operator: accepts commands
- Control loop → Settings state: loads and saves (evidence: `src/main.cpp`)
- Settings state → EEPROM: reads and writes (evidence: `src/main.cpp`)
