diff options
author | Wolfgang (Wolle) Ewald <wolfgang.ewald@wolles-elektronikkiste.de> | 2021-04-21 20:24:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-21 20:24:24 +0200 |
commit | b3f5703830b9d5f41c9844f78d153b3d86b5648d (patch) | |
tree | cf23674c011921f9dd245a110b1a59ab5cfa37a6 /examples/Auto_Range/Auto_Range.ino | |
parent | Delete dummy (diff) | |
download | ADS1115_WE-1.3.3.tar ADS1115_WE-1.3.3.tar.gz ADS1115_WE-1.3.3.tar.bz2 ADS1115_WE-1.3.3.tar.lz ADS1115_WE-1.3.3.tar.xz ADS1115_WE-1.3.3.tar.zst ADS1115_WE-1.3.3.zip |
Diffstat (limited to 'examples/Auto_Range/Auto_Range.ino')
-rw-r--r-- | examples/Auto_Range/Auto_Range.ino | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/examples/Auto_Range/Auto_Range.ino b/examples/Auto_Range/Auto_Range.ino index 5cef117..31d494e 100644 --- a/examples/Auto_Range/Auto_Range.ino +++ b/examples/Auto_Range/Auto_Range.ino @@ -112,6 +112,13 @@ void setup() { */
//adc.setAlertPinToConversionReady(); //uncomment if you want to change the default
+ /* Enable or disable permanent automatic range selection mode. If enabled, the range will
+ * change if the measured values are outside of 30-80% of the maximum value of the current
+ * range.
+ * !!! Use EITHER this function once OR setAutoRange() whenever needed (see below) !!!
+ */
+ adc.setPermanentAutoRangeMode(true);
+
Serial.println("ADS1115 Example Sketch - Continuous Mode with Auto Range");
Serial.println();
}
@@ -150,10 +157,11 @@ float readChannel(ADS1115_MUX channel) { * would need for three conversions.
* If the ADS115 is in single shot mode, setAutoRange() will switch into continuous
* mode to measure a value and switch back again.
+ * !!! Use EITHER this function whenever needed OR setPermanentAutoRangeMode(true) once !!!
*/
- adc.setAutoRange();
- printVoltageRange(); // this is just to show that the range is changing with changing voltages
+ //adc.setAutoRange();
adc.getResult_mV();
+ printVoltageRange(); // this is just to show that the range is changing with changing voltages
voltage = adc.getResult_V(); // alternative: getResult_mV for Millivolt
return voltage;
}
|