# darkwood-byte/robotica architecture

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

- Interactive diagram: https://gitdiagram.com/darkwood-byte/robotica
- Repository: https://github.com/darkwood-byte/robotica

## Overview

Robotica is Pico firmware for a two-axis telescope mount. A user sends a pan:tilt command over serial; the serial handler parses it and calls Robot::Move, which sets motor goals. A repeating timer ticks both motors, whose sensor-guided state machines calibrate and move them; the robot also updates status LEDs. The README is empty, so capabilities and wiring here are based on the sampled source; external hardware details are limited to the GPIO and UART calls shown.

Main entry points: [`Robot.cpp`](https://github.com/darkwood-byte/robotica/blob/main/Robot.cpp) (Robot coordinator), [`Motor.cpp`](https://github.com/darkwood-byte/robotica/blob/main/Motor.cpp) (Motor controller), [`SerialIRQHandler.cpp`](https://github.com/darkwood-byte/robotica/blob/main/SerialIRQHandler.cpp) (Command handler), [`Main.cpp`](https://github.com/darkwood-byte/robotica/blob/main/Main.cpp) (Firmware entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_main["Firmware entry<br/>[Main.cpp]"]
  node_serial["Command handler"]
end

subgraph group_motion["Motion Control"]
  node_robot["Robot coordinator<br/>[Robot.cpp]"]
  node_motor["Motor controller<br/>[Motor.cpp]"]
end

subgraph group_io["Hardware I/O"]
  node_sensor["Limit sensor<br/>[Sensor.cpp]"]
  node_status["Status LED signals<br/>[error.h]"]
end

node_operator(("Serial operator"))
node_pico["Pico UART and GPIO"]

node_operator -->|"sends commands"| node_pico
node_pico -->|"delivers input"| node_serial
node_main -->|"initializes"| node_robot
node_main -->|"registers handler"| node_serial
node_serial -->|"moves to goals"| node_robot
node_robot -->|"initializes motors"| node_motor
node_robot -->|"ticks motors"| node_motor
node_motor -->|"initializes and checks"| node_sensor
node_motor -->|"drives step pins"| node_pico
node_sensor -->|"reads inputs"| node_pico
node_robot -->|"updates indicators"| node_status
node_status -->|"sets LED pins"| node_pico

click node_main "https://github.com/darkwood-byte/robotica/blob/main/Main.cpp"
click node_serial "https://github.com/darkwood-byte/robotica/blob/main/SerialIRQHandler.cpp"
click node_robot "https://github.com/darkwood-byte/robotica/blob/main/Robot.cpp"
click node_motor "https://github.com/darkwood-byte/robotica/blob/main/Motor.cpp"
click node_sensor "https://github.com/darkwood-byte/robotica/blob/main/Sensor.cpp"
click node_status "https://github.com/darkwood-byte/robotica/blob/main/error.h"

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_serial toneBlue
class node_robot,node_motor toneAmber
class node_sensor,node_status toneMint
class node_operator,node_pico toneIndigo
```

## Components

### Application

- [Firmware entry](https://github.com/darkwood-byte/robotica/blob/main/Main.cpp): `Main.cpp`
- [Command handler](https://github.com/darkwood-byte/robotica/blob/main/SerialIRQHandler.cpp): `SerialIRQHandler.cpp`

### Motion Control

- [Robot coordinator](https://github.com/darkwood-byte/robotica/blob/main/Robot.cpp): `Robot.cpp`
- [Motor controller](https://github.com/darkwood-byte/robotica/blob/main/Motor.cpp): `Motor.cpp`

### Hardware I/O

- [Limit sensor](https://github.com/darkwood-byte/robotica/blob/main/Sensor.cpp): `Sensor.cpp`
- [Status LED signals](https://github.com/darkwood-byte/robotica/blob/main/error.h): `error.h`

### Other components

- **Serial operator**
- **Pico UART and GPIO**

## Connections

- Serial operator → Pico UART and GPIO: sends commands
- Pico UART and GPIO → Command handler: delivers input
- Firmware entry → Robot coordinator: initializes
- Firmware entry → Command handler: registers handler
- Command handler → Robot coordinator: moves to goals
- Robot coordinator → Motor controller: initializes motors
- Robot coordinator → Motor controller: ticks motors
- Motor controller → Limit sensor: initializes and checks
- Motor controller → Pico UART and GPIO: drives step pins
- Limit sensor → Pico UART and GPIO: reads inputs
- Robot coordinator → Status LED signals: updates indicators
- Status LED signals → Pico UART and GPIO: sets LED pins
