From 7381d6d6e187871e0aa102c1f10bdb4fbb61eb0e Mon Sep 17 00:00:00 2001 From: anschrammh Date: Mon, 11 May 2020 12:41:16 +0200 Subject: [PATCH] =?UTF-8?q?Ajout=20du=20dossier=20de=20test=20(fourre-tout?= =?UTF-8?q?)=20contenant=20diff=C3=A9rent=20codes=20de=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/TestLibAdc/TestLibAdc.ino | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 test/TestLibAdc/TestLibAdc.ino diff --git a/test/TestLibAdc/TestLibAdc.ino b/test/TestLibAdc/TestLibAdc.ino new file mode 100644 index 0000000..cae6f4c --- /dev/null +++ b/test/TestLibAdc/TestLibAdc.ino @@ -0,0 +1,34 @@ +#include "Ads1115V2.h" + +AdcSetting adcSetting(3300.0, 15, 1, 10); +Ads1115V2 adc; + +uint8_t channel(0); + +void setup() { + // put your setup code here, to run once: + Serial.begin(115200); + delay(1000); + Serial.println("Start setup"); + adc.begin(); + adc.setAdcSetting(adcSetting); + //measureUnit.setGlobalTempOffset(-17); + Serial.println("End setup"); +} + +void loop() { + // put your main code here, to run repeatedly: + adc.startSample(channel); + + if(adc.isSampleReady()) + { + Serial.print("Sample is ready : ");Serial.println(channel); + double raw = adc.getSampleValue(); + Serial.print("Value : ");Serial.println(raw,4); + Serial.print("Voltage : ");Serial.println(raw * adc.getQuantum()); + Serial.println(); + + channel++; + channel %= 8; + } +}