GY-63_MS5611/libraries/DMM/DMM.h

61 lines
1.1 KiB
C
Raw Normal View History

2022-12-21 15:16:14 -05:00
#pragma once
//
// FILE: DMM.h
// AUTHOR: Rob Tillaart
2023-02-04 08:10:04 -05:00
// VERSION: 0.1.2
2022-12-21 15:16:14 -05:00
// DATE: 2022-12-19
// PURPOSE: Library for a DMM class for Arduino.
// URL: https://github.com/RobTillaart/DMM
#include "Arduino.h"
2023-02-04 08:10:04 -05:00
#define DMM_LIB_VERSION (F("0.1.2"))
2022-12-21 15:16:14 -05:00
class DMM
{
public:
DMM();
void begin(uint8_t pin, float maxVoltage, uint16_t maxSteps);
2023-02-04 08:10:04 -05:00
2022-12-21 15:16:14 -05:00
// CALIBRATION
void setMaxVoltage(float maxVoltage);
float getMaxVoltage();
2023-02-04 08:10:04 -05:00
2022-12-21 15:16:14 -05:00
// GAIN e.g. due to voltage divider
// a 25V to 5V divider has a factor = 5.
void setGain(float factor = 1.0);
float getGain();
2023-02-04 08:10:04 -05:00
// READ VOLTAGE
2022-12-21 15:16:14 -05:00
float readVolts(uint8_t times = 1);
float readMilliVolts(uint8_t times = 1);
float readNoise(uint8_t times = 1);
2023-02-04 08:10:04 -05:00
// READ OHM
void setReferenceR(float ohm);
float readOhm(uint8_t times = 1);
float readKiloOhm(uint8_t times = 1);
2022-12-21 15:16:14 -05:00
private:
uint8_t _pin = 14; // A0;
float _maxVoltage = 5.0;
uint16_t _maxSteps = 1023;
float _voltageStep = _maxVoltage/_maxSteps;
float _gain = 1.0;
2023-02-04 08:10:04 -05:00
float _ReferenceR = 0;
2022-12-21 15:16:14 -05:00
};
// -- END OF FILE --