35 lines
768 B
C++
35 lines
768 B
C++
#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;
|
|
}
|
|
}
|