# ESP32-C3 Python Test Tools

This folder contains a standalone Python test suite for the ESP32-C3 status light.

## Files

- `requirements.txt`: Python dependencies
- `light_test_common.py`: shared serial and port-detection logic
- `send_state.py`: send one state command
- `run_sequence.py`: run a timed sequence of state commands
- `monitor_boot.py`: read boot and runtime serial logs
- `smoke_test.py`: basic end-to-end test flow
- `interactive_session.py`: keep one serial session open and send commands manually

## Setup

```powershell
Set-Location C:\Users\a\Documents\Arduino\sketch_may27a\python_test_tools
python -m pip install -r requirements.txt
```

If auto-detection does not find the board, set:

```powershell
$env:CODEX_LIGHT_PORT="COM38"
```

## Quick Commands

Send one command:

```powershell
python .\send_state.py THINKING
python .\send_state.py DONE
python .\send_state.py TOKEN:75
```

Read serial output for 8 seconds:

```powershell
python .\monitor_boot.py --seconds 8
```

Run a state sequence:

```powershell
python .\run_sequence.py
```

Run a smoke test:

```powershell
python .\smoke_test.py
```

Run an interactive session:

```powershell
python .\interactive_session.py
```

## Notes

- Close Arduino Serial Monitor before running these scripts.
- If you see `PermissionError(13)`, another process is holding the COM port.
- `interactive_session.py` is the most reliable test because it keeps the serial port open.
- `smoke_test.py` only checks whether the board accepts commands and whether serial output is readable. It does not verify LED color with a sensor.
