# jasurdevv/iot-lab-2 architecture

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

- Interactive diagram: https://gitdiagram.com/jasurdevv/iot-lab-2
- Repository: https://github.com/jasurdevv/iot-lab-2

## Overview

This repository is an IoT lab template with four independent Arduino exercises, each implementing its own setup/loop behavior rather than forming one application pipeline. The workflows cover LED chasing, light-sensor statistics, threshold alerts with hysteresis, and debounced button counting with an LED pattern. Each sketch directly reads or drives its hardware and reports through Serial. The README documents the board pin assignments and expected behavior. The available excerpts do not show how a build selects among the four sketches, so no selection or orchestration link is drawn.

Main entry points: [`src/ex4.cpp`](https://github.com/jasurdevv/iot-lab-2/blob/main/src/ex4.cpp) (Counter Loop), [`src/ex1.cpp`](https://github.com/jasurdevv/iot-lab-2/blob/main/src/ex1.cpp) (Chase Loop), [`src/ex2.cpp`](https://github.com/jasurdevv/iot-lab-2/blob/main/src/ex2.cpp) (Statistics Loop), [`src/ex3.cpp`](https://github.com/jasurdevv/iot-lab-2/blob/main/src/ex3.cpp) (Alert Loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_chase["LED Chase"]
  node_ex1["Chase Loop<br/>[ex1.cpp]"]
end

subgraph group_stats["Sensor Statistics"]
  node_ex2["Statistics Loop<br/>[ex2.cpp]"]
end

subgraph group_alert["Threshold Alert"]
  node_ex3["Alert Loop<br/>[ex3.cpp]"]
end

subgraph group_counter["Button Counter"]
  node_ex4["Counter Loop<br/>[ex4.cpp]"]
end

node_leds["LEDs"]
node_light["Light Sensor"]
node_button["Button"]
node_serial(("Serial Monitor"))

node_ex1 -->|"drives LEDs"| node_leds
node_ex1 -->|"prints chase"| node_serial
node_ex2 -->|"samples light"| node_light
node_ex2 -->|"prints statistics"| node_serial
node_ex3 -->|"reads level"| node_light
node_ex3 -->|"prints transitions"| node_serial
node_ex4 -->|"reads presses"| node_button
node_ex4 -->|"sets pattern"| node_leds
node_ex4 -->|"prints count"| node_serial

click node_ex1 "https://github.com/jasurdevv/iot-lab-2/blob/main/src/ex1.cpp"
click node_ex2 "https://github.com/jasurdevv/iot-lab-2/blob/main/src/ex2.cpp"
click node_ex3 "https://github.com/jasurdevv/iot-lab-2/blob/main/src/ex3.cpp"
click node_ex4 "https://github.com/jasurdevv/iot-lab-2/blob/main/src/ex4.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_ex1 toneBlue
class node_ex2 toneAmber
class node_ex3 toneMint
class node_ex4 toneRose
class node_leds,node_light,node_button,node_serial toneIndigo
```

## Components

### LED Chase

- [Chase Loop](https://github.com/jasurdevv/iot-lab-2/blob/main/src/ex1.cpp): `src/ex1.cpp`

### Sensor Statistics

- [Statistics Loop](https://github.com/jasurdevv/iot-lab-2/blob/main/src/ex2.cpp): `src/ex2.cpp`

### Threshold Alert

- [Alert Loop](https://github.com/jasurdevv/iot-lab-2/blob/main/src/ex3.cpp): `src/ex3.cpp`

### Button Counter

- [Counter Loop](https://github.com/jasurdevv/iot-lab-2/blob/main/src/ex4.cpp): `src/ex4.cpp`

### Other components

- **LEDs**
- **Light Sensor**
- **Button**
- **Serial Monitor**

## Connections

- Chase Loop → LEDs: drives LEDs (evidence: `src/ex1.cpp`)
- Chase Loop → Serial Monitor: prints chase (evidence: `src/ex1.cpp`)
- Statistics Loop → Light Sensor: samples light (evidence: `src/ex2.cpp`)
- Statistics Loop → Serial Monitor: prints statistics (evidence: `src/ex2.cpp`)
- Alert Loop → Light Sensor: reads level (evidence: `src/ex3.cpp`)
- Alert Loop → Serial Monitor: prints transitions (evidence: `src/ex3.cpp`)
- Counter Loop → Button: reads presses (evidence: `src/ex4.cpp`)
- Counter Loop → LEDs: sets pattern (evidence: `src/ex4.cpp`)
- Counter Loop → Serial Monitor: prints count (evidence: `src/ex4.cpp`)
