diff options
author | Wolfgang (Wolle) Ewald <wolfgang.ewald@wolles-elektronikkiste.de> | 2020-08-04 18:56:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-04 18:56:52 +0200 |
commit | 43401e0461c7c3073cc57ec6050d2cae5ab4299f (patch) | |
tree | 8b5d3c8c4bd01d59563b6e7d976ca26dbbdfc5fe /src/ADS1115_WE.cpp | |
parent | Update ADS1115_WE.h (diff) | |
download | ADS1115_WE-43401e0461c7c3073cc57ec6050d2cae5ab4299f.tar ADS1115_WE-43401e0461c7c3073cc57ec6050d2cae5ab4299f.tar.gz ADS1115_WE-43401e0461c7c3073cc57ec6050d2cae5ab4299f.tar.bz2 ADS1115_WE-43401e0461c7c3073cc57ec6050d2cae5ab4299f.tar.lz ADS1115_WE-43401e0461c7c3073cc57ec6050d2cae5ab4299f.tar.xz ADS1115_WE-43401e0461c7c3073cc57ec6050d2cae5ab4299f.tar.zst ADS1115_WE-43401e0461c7c3073cc57ec6050d2cae5ab4299f.zip |
Diffstat (limited to 'src/ADS1115_WE.cpp')
-rw-r--r-- | src/ADS1115_WE.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/ADS1115_WE.cpp b/src/ADS1115_WE.cpp index e3df817..9da6d48 100644 --- a/src/ADS1115_WE.cpp +++ b/src/ADS1115_WE.cpp @@ -163,6 +163,15 @@ float ADS1115_WE::getResult_mV(){ return result;
}
+int16_t ADS1115_WE::getResultWithRange(int16_t min, int16_t max){
+ int16_t rawResult = readRegister(ADS1115_CONV_REG);
+ //rawResult = (int) (rawResult * (voltageRange * 1.0 / 6144));
+ int16_t result = 0;
+ result = map(rawResult, 0, 32767, min, max);
+ return result;
+}
+
+
void ADS1115_WE::setAlertPinToConversionReady(){
writeRegister(ADS1115_LO_THRESH_REG, (0<<15));
writeRegister(ADS1115_HI_THRESH_REG, (1<<15));
|