Skip to content

Latest commit

 

History

History
37 lines (25 loc) · 708 Bytes

File metadata and controls

37 lines (25 loc) · 708 Bytes

KLib-Sensor

KLib-Sensor is a lightweight library for managing sensor values and detecting changes.

Installation

Using PlatformIO

Add the following to platformio.ini:

lib_deps = https://github.com/KazaLab/KLib-EnvSensor.git

Usage

#include <KLib_Sensor.h>

KLib_Sensor temperatureSensor("temperature");

void setup() {
    Serial.begin(115200);
}

void loop() {
    float newTemperature = random(20, 30); // Simulated temperature value

    if (temperatureSensor.hasChanged(newTemperature, 0.5)) {
        Serial.print("New Temperature: ");
        Serial.println(newTemperature);
        temperatureSensor.updateValue(newTemperature);
    }

    delay(2000);
}