# a-bernard1/tank_app architecture

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

- Interactive diagram: https://gitdiagram.com/a-bernard1/tank_app
- Repository: https://github.com/a-bernard1/tank_app

## Overview

Mini Tank is a remotely controlled tracked vehicle with separate chassis and turret Arduino firmware plus a Flutter mobile app. The documented user workflow is mobile control over Bluetooth Low Energy, chassis differential-drive commands, and turret positioning commands; chassis firmware also publishes battery voltage. The available tree contains no Flutter/Dart application sources, so the app is represented only as a documented subsystem, and its connection to the firmware is unverified here. The turret command source is shown separately because the excerpts do not establish how it receives commands from the mobile app or chassis.

Main entry points: [`arduino_tank_code/chassis_arduino_project/src/main.cpp`](https://github.com/a-bernard1/tank_app/blob/main/arduino_tank_code/chassis_arduino_project/src/main.cpp) (BLE chassis loop), [`mobile_app`](https://github.com/a-bernard1/tank_app/tree/main/mobile_app) (Flutter app), [`arduino_tank_code/turret_arduino_project/src/main.cpp`](https://github.com/a-bernard1/tank_app/blob/main/arduino_tank_code/turret_arduino_project/src/main.cpp) (Turret command loop), [`arduino_tank_code/chassis_arduino_project/src/Tank.cpp`](https://github.com/a-bernard1/tank_app/blob/main/arduino_tank_code/chassis_arduino_project/src/Tank.cpp) (Tank motion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Mobile control"]
  node_mobile_app["Flutter app"]
end

subgraph group_chassis["Chassis firmware"]
  node_chassis_entry["BLE chassis loop<br/>[main.cpp]"]
  node_tank_logic["Tank motion<br/>[Tank.cpp]"]
  node_drive_motors["Drive motors<br/>[Motor.cpp]"]
  node_battery["Battery sensing<br/>[Battery.cpp]"]
end

subgraph group_turret["Turret firmware"]
  node_turret_entry["Turret command loop<br/>[main.cpp]"]
  node_transmission["Command transmission<br/>[Transmission.cpp]"]
  node_stepper_library["Stepper motion library<br/>[AccelStepper.cpp]"]
end

node_operator(("Operator"))

node_operator -.->|"controls"| node_mobile_app
node_mobile_app -.->|"sends BLE commands"| node_chassis_entry
node_chassis_entry -->|"dispatches commands"| node_tank_logic
node_tank_logic -->|"drives"| node_drive_motors
node_chassis_entry -->|"reads voltage"| node_battery
node_chassis_entry -.->|"notifies voltage"| node_mobile_app
node_turret_entry -->|"reads orders"| node_transmission
node_turret_entry -->|"positions motors"| node_stepper_library

click node_mobile_app "https://github.com/a-bernard1/tank_app/tree/main/mobile_app"
click node_chassis_entry "https://github.com/a-bernard1/tank_app/blob/main/arduino_tank_code/chassis_arduino_project/src/main.cpp"
click node_tank_logic "https://github.com/a-bernard1/tank_app/blob/main/arduino_tank_code/chassis_arduino_project/src/Tank.cpp"
click node_drive_motors "https://github.com/a-bernard1/tank_app/blob/main/arduino_tank_code/chassis_arduino_project/src/Motor.cpp"
click node_battery "https://github.com/a-bernard1/tank_app/blob/main/arduino_tank_code/chassis_arduino_project/src/Battery.cpp"
click node_turret_entry "https://github.com/a-bernard1/tank_app/blob/main/arduino_tank_code/turret_arduino_project/src/main.cpp"
click node_transmission "https://github.com/a-bernard1/tank_app/blob/main/arduino_tank_code/turret_arduino_project/src/Transmission.cpp"
click node_stepper_library "https://github.com/a-bernard1/tank_app/blob/main/arduino_tank_code/turret_arduino_project/src/AccelStepper.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_mobile_app toneBlue
class node_chassis_entry,node_tank_logic,node_drive_motors,node_battery toneAmber
class node_turret_entry,node_transmission,node_stepper_library toneMint
class node_operator toneIndigo
```

## Components

### Mobile control

- [Flutter app](https://github.com/a-bernard1/tank_app/tree/main/mobile_app): `mobile_app`

### Chassis firmware

- [BLE chassis loop](https://github.com/a-bernard1/tank_app/blob/main/arduino_tank_code/chassis_arduino_project/src/main.cpp): `arduino_tank_code/chassis_arduino_project/src/main.cpp`
- [Tank motion](https://github.com/a-bernard1/tank_app/blob/main/arduino_tank_code/chassis_arduino_project/src/Tank.cpp): `arduino_tank_code/chassis_arduino_project/src/Tank.cpp`
- [Drive motors](https://github.com/a-bernard1/tank_app/blob/main/arduino_tank_code/chassis_arduino_project/src/Motor.cpp): `arduino_tank_code/chassis_arduino_project/src/Motor.cpp`
- [Battery sensing](https://github.com/a-bernard1/tank_app/blob/main/arduino_tank_code/chassis_arduino_project/src/Battery.cpp): `arduino_tank_code/chassis_arduino_project/src/Battery.cpp`

### Turret firmware

- [Turret command loop](https://github.com/a-bernard1/tank_app/blob/main/arduino_tank_code/turret_arduino_project/src/main.cpp): `arduino_tank_code/turret_arduino_project/src/main.cpp`
- [Command transmission](https://github.com/a-bernard1/tank_app/blob/main/arduino_tank_code/turret_arduino_project/src/Transmission.cpp): `arduino_tank_code/turret_arduino_project/src/Transmission.cpp`
- [Stepper motion library](https://github.com/a-bernard1/tank_app/blob/main/arduino_tank_code/turret_arduino_project/src/AccelStepper.cpp): `arduino_tank_code/turret_arduino_project/src/AccelStepper.cpp`

### Other components

- **Operator**

## Connections

- Operator → Flutter app: controls
- Flutter app → BLE chassis loop: sends BLE commands
- BLE chassis loop → Tank motion: dispatches commands (evidence: `arduino_tank_code/chassis_arduino_project/src/main.cpp`)
- Tank motion → Drive motors: drives
- BLE chassis loop → Battery sensing: reads voltage (evidence: `arduino_tank_code/chassis_arduino_project/src/main.cpp`)
- BLE chassis loop → Flutter app: notifies voltage
- Turret command loop → Command transmission: reads orders (evidence: `arduino_tank_code/turret_arduino_project/src/main.cpp`)
- Turret command loop → Stepper motion library: positions motors (evidence: `arduino_tank_code/turret_arduino_project/src/main.cpp`)
