# revijiheoifh/robotcode architecture

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

- Interactive diagram: https://gitdiagram.com/revijiheoifh/robotcode
- Repository: https://github.com/revijiheoifh/robotcode

## Overview

This repository is a collection of Raspberry Pi utilities rather than one integrated application: it provides motor control, motion sensing, TCP messaging, and speech/audio playback. The clearest runtime workflow is motor startup, configuration, and repeated stepping; the other utilities operate independently. Connections follow the sampled calls and imports. No README was provided, and no links between the separate utilities are established by the available evidence.

Main entry points: [`network/networkingLib.py`](https://github.com/revijiheoifh/robotcode/blob/main/network/networkingLib.py) (TCP server and client), [`motorDriving/main.c`](https://github.com/revijiheoifh/robotcode/blob/main/motorDriving/main.c) (Motor entry), [`motorDriving/motorManager.h`](https://github.com/revijiheoifh/robotcode/blob/main/motorDriving/motorManager.h) (Motor manager), [`motorDriving/motor.c`](https://github.com/revijiheoifh/robotcode/blob/main/motorDriving/motor.c) (Motor control)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_motion["Motion and motors"]
  node_motor_main["Motor entry<br/>[main.c]"]
  node_motor_manager["Motor manager<br/>[motorManager.h]"]
  node_motor_library["Motor control<br/>[motor.c]"]
  node_accel["Motion sensor<br/>[accel.cpp]"]
end

subgraph group_network["TCP messaging"]
  node_server_entry["Server entry<br/>[server.py]"]
  node_network_lib["TCP server and client<br/>[networkingLib.py]"]
end

subgraph group_speech["Speech and audio"]
  node_tts["Text-to-speech<br/>[textToSpeech.py]"]
  node_pcm_audio["PCM playback<br/>[audio.c]"]
end

node_operator(("Operator"))
node_gpio["pigpio GPIO"]
node_mpu["MPU6050"]
node_tcp_peer(("TCP peer"))
node_espeak["espeak"]
node_pcm_file["PCM input file"]

node_motor_main -->|"initializes"| node_gpio
node_motor_main -->|"runs setup and update"| node_motor_manager
node_motor_manager -->|"configures and controls"| node_motor_library
node_motor_library -->|"drives pins"| node_gpio
node_accel -->|"reads sensor data"| node_mpu
node_server_entry -->|"starts server"| node_network_lib
node_operator -->|"provides replies"| node_network_lib
node_tcp_peer -->|"exchanges messages"| node_network_lib
node_operator -.->|"supplies text"| node_tts
node_tts -->|"runs speech"| node_espeak
node_pcm_file -->|"provides samples"| node_pcm_audio
node_pcm_audio -->|"outputs PWM audio"| node_gpio

click node_motor_main "https://github.com/revijiheoifh/robotcode/blob/main/motorDriving/main.c"
click node_motor_manager "https://github.com/revijiheoifh/robotcode/blob/main/motorDriving/motorManager.h"
click node_motor_library "https://github.com/revijiheoifh/robotcode/blob/main/motorDriving/motor.c"
click node_accel "https://github.com/revijiheoifh/robotcode/blob/main/accelCode/accel.cpp"
click node_server_entry "https://github.com/revijiheoifh/robotcode/blob/main/server.py"
click node_network_lib "https://github.com/revijiheoifh/robotcode/blob/main/network/networkingLib.py"
click node_tts "https://github.com/revijiheoifh/robotcode/blob/main/tts/textToSpeech.py"
click node_pcm_audio "https://github.com/revijiheoifh/robotcode/blob/main/audio/audio.c"

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_motor_main,node_motor_manager,node_motor_library,node_accel toneBlue
class node_server_entry,node_network_lib toneAmber
class node_tts,node_pcm_audio toneMint
class node_operator,node_gpio,node_mpu,node_tcp_peer,node_espeak,node_pcm_file toneIndigo
```

## Components

### Motion and motors

- [Motor entry](https://github.com/revijiheoifh/robotcode/blob/main/motorDriving/main.c): `motorDriving/main.c`
- [Motor manager](https://github.com/revijiheoifh/robotcode/blob/main/motorDriving/motorManager.h): `motorDriving/motorManager.h`
- [Motor control](https://github.com/revijiheoifh/robotcode/blob/main/motorDriving/motor.c): `motorDriving/motor.c`
- [Motion sensor](https://github.com/revijiheoifh/robotcode/blob/main/accelCode/accel.cpp): `accelCode/accel.cpp`

### TCP messaging

- [Server entry](https://github.com/revijiheoifh/robotcode/blob/main/server.py): `server.py`
- [TCP server and client](https://github.com/revijiheoifh/robotcode/blob/main/network/networkingLib.py): `network/networkingLib.py`

### Speech and audio

- [Text-to-speech](https://github.com/revijiheoifh/robotcode/blob/main/tts/textToSpeech.py): `tts/textToSpeech.py`
- [PCM playback](https://github.com/revijiheoifh/robotcode/blob/main/audio/audio.c): `audio/audio.c`

### Other components

- **Operator**
- **pigpio GPIO**
- **MPU6050**
- **TCP peer**
- **espeak**
- **PCM input file**

## Connections

- Motor entry → pigpio GPIO: initializes (evidence: `motorDriving/main.c`)
- Motor entry → Motor manager: runs setup and update (evidence: `motorDriving/main.c`)
- Motor manager → Motor control: configures and controls (evidence: `motorDriving/motorManager.h`)
- Motor control → pigpio GPIO: drives pins (evidence: `motorDriving/motor.c`)
- Motion sensor → MPU6050: reads sensor data (evidence: `accelCode/accel.cpp`)
- Server entry → TCP server and client: starts server (evidence: `server.py`)
- Operator → TCP server and client: provides replies (evidence: `network/networkingLib.py`)
- TCP peer → TCP server and client: exchanges messages (evidence: `network/networkingLib.py`)
- Operator → Text-to-speech: supplies text
- Text-to-speech → espeak: runs speech (evidence: `tts/textToSpeech.py`)
- PCM input file → PCM playback: provides samples (evidence: `audio/audio.c`)
- PCM playback → pigpio GPIO: outputs PWM audio (evidence: `audio/audio.c`)
