Metadata-Version: 2.4
Name: iot-practical-kit
Version: 0.2.0
Summary: Print source code for common Raspberry Pi IoT practicals
Author: IoT Practical Kit Contributors
License: MIT
Keywords: iot,raspberry-pi,education,practicals,python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Education
Classifier: Topic :: Education
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# IoT Practical Kit

A small Python package that **prints the source code** for common Raspberry Pi IoT practicals. It does not execute the displayed programs.

## Install for local development

```bash
python -m pip install -e .
```

After publication on PyPI, install with:

```bash
python -m pip install iot-practical-kit
```

## Quick start

```python
from iot_practical_kit import p1

p1()  # Prints the complete P1 LED blinking source code only
```

## Available functions

All code comes from the IoT Practical Exam Cheat Sheet.

| Function | Practical | Programs |
|---|---|---|
| `p1()` | P1 — LED patterns | 6 |
| `p6()` | P6 — 16x2 LCD | 6 |
| `p7()` | P7 — RFID RC522 | 5 |
| `p8()` | P8 — Fingerprint | 7 |
| `p9()` | P9 — Pi Camera | 7 |
| `p10()` | P10 — Touch + Ultrasonic | 6 |
| `p11()` | P11 — Fingerprint + LCD | 4 |
| `p12()` | P12 — Smart door lock | 4 |
| `p14()` | P14 — Flask `app.py` | 4 |
| `p14_html()` | P14 — `templates/index.html` (program n pairs with `p14(n)`) | 4 |
| `list_practicals()` | Print the numbered index with a short note for every program | |
| `get_code("p1")` | Return source as a string instead of printing | |

Run `list_practicals()` to see every program with a one-line description.

Every practical function (and `get_code`) takes two optional arguments:

```python
p1()                 # all 5 programs of P1 (BCM numbering)
p1(3)                # only program 3 (running LED)
p10(2)               # only Part C (ultrasonic)
p10(board=True)      # GPIO.BOARD version (physical pin numbers)
get_code("p6", 3)    # scrolling-text program, returned as a string
```

## Output format

Printed code contains no comments at all. When a practical prints several programs together, they are separated by blank lines; use `p1(3)` to print just one program.

## Important notes

- Calling `p1()` prints source code; it does **not** execute the GPIO program.
- Raspberry Pi-specific code requires compatible Raspberry Pi hardware, libraries, and OS to run.
- Pin assignments follow BCM numbering by default. Pass `board=True` for the physical-pin (GPIO.BOARD) version. P7, P8 and P9 are identical in both modes.
- Check your class handout and wiring before using any snippet. These examples are study templates and may need adjustment for your sensor model, library version, and OS.
- For HC-SR04 ultrasonic sensors, the ECHO signal is commonly 5V. Raspberry Pi GPIO is 3.3V tolerant: use a suitable voltage divider or level shifter.
- For fingerprint examples, update the serial port and ensure the sensor is enrolled and connected correctly.
- The P14 web monitor has two source files: call `p14()` for `app.py` and `p14_html()` for `templates/index.html`.

## Repository structure

```text
iot-practical-kit/
├── pyproject.toml
├── README.md
└── src/
    └── iot_practical_kit/
        ├── __init__.py
        └── practicals.py
```

## License

MIT
