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; + } +}