mq2_pcf8563 0.1.1

No-std MQ-2 gas sensor logic + PCF8563 RTC support
Documentation
## mq2_pcf8563

[![crates.io](https://img.shields.io/crates/v/mq2_pcf8563.svg)](https://crates.io/crates/mq2_pcf8563)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE-MIT)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE-APACHE)

Rust crate for reading **MQ-2 gas sensor** (ADC) + **HZ-8563/PCF8563 RTC** (I²C) on **Arduino Uno** / AVR.

Features:
- Clean-air baseline calibration
- Gas index calculation with smoothing
- Timestamped logging via serial
- High-gas alert threshold

## Hardware Connections

- MQ-2: VCC → 5V, GND → GND, AOUT → A0
- HZ-8563/PCF8563: VCC → 5V, GND → GND, SDA → A4, SCL → A5
- 4.7kΩ pull-up resistors on SDA and SCL to 5V (required for reliable I²C)

## Installation

```toml
[dependencies]
mq2_pcf8563 = "0.1.0"

```

## For development/testing with Arduino Uno, also add arduino-hal (git dep):

```toml

[dependencies.arduino-hal]
git = "https://github.com/Rahix/avr-hal"
rev = "e5c8f37fe48419956e722490a82b9ca9b9fc61a2"
features = ["arduino-uno"]

```

## Usage Example

See the `examples/basic_logger.rs` for a complete runnable binary that:
- Calibrates the sensor
- Logs timestamp + raw + index
- Prints alert when index exceeds threshold

```bash
cargo run --example basic_logger --release

```

The example uses arduino-hal (git-dependency) and
is not part of the published crate on crates.io.
Its for development and testing only.


## LLM Usage Declaration

Parts of the `gas_index` function (scaling and curve ideas)
and the `pad2`/`pad4` formatting helpers were inspired or adapted 
from suggestions generated by LLM tools (Grok/ChatGPT). 

All code was manually reviewed, tested, and refined by me.


## License
Licensed under either of

- MIT license ([LICENSE-MIT]LICENSE-MIT or <http://opensource.org/licenses/MIT>)


## Contribution

Contributions are welcome! You can help by:

1. Reporting Issues
- Found a bug or unexpected behavior? Open an issue on GitHub.

2. Suggesting Features
- Ideas for improvements, new sensors, or functionality are always appreciated.

3. Submitting Pull Requests
- Fork the repository and make changes in a separate branch.

4. Ensure your code compiles and follows the project style.
- Include clear commit messages and, if applicable, update documentation.

5. Testing
- Test any new features or fixes on an Arduino with the MQ-2 sensor and PCF8563 RTC (or compatible hardware).