From b3f5703830b9d5f41c9844f78d153b3d86b5648d Mon Sep 17 00:00:00 2001 From: "Wolfgang (Wolle) Ewald" Date: Wed, 21 Apr 2021 20:24:24 +0200 Subject: Add files via upload --- examples/Auto_Range/Auto_Range.ino | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'examples') 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; } -- cgit v1.2.3