Skip to content

Library with functions for common formulas used on embedded systems.

License

Notifications You must be signed in to change notification settings

gfurtadoalmeida/iot-lib-formulas

Repository files navigation

IoT Formulas Library

GitHub Build Status Bugs Code Smells Maintainability Rating Security Rating Quality Gate Status
A C library with functions for common formulas used on embedded systems.

Characteristics

Functions For

Documentation

Everything is at the docs folder.

Example: Calculate Temperature in ºC from Thermistor on a Voltage Divider

#include <stdio.h>
#include "iot_lib_formulas/voltage_divider.h"
#include "iot_lib_formulas/thermistor.h"
#include "iot_lib_formulas/temperature.h"

void app_main(void)
{
    float_type thermistor_resistance = volt_divider_resistive_calc_resistor_2(5.0,     // 5V in.
                                                                              10000.0, // 10K resistor 1
                                                                              2.5);    // 2.5V out.

    float_type kelvin = thermistor_calc_temperature_steinhart_betha(COMMON_THERM_PROBE_AMBIENT_TEMP_KELVIN,
                                                                    COMMON_THERM_PROBE_RESISTANCE,
                                                                    COMMON_THERM_PROBE_BETHA,
                                                                    thermistor_resistance);
    float_type celsius = CONV_KELVIN_CELSIUS(kelvin);

    prinft("Temperature: %f celsius", celsius);
}