#include "LTC2439.h"

LTC2439 adc(2,12);
uint8_t channel(0);

void setup()
{
  Serial.begin(115200);
  Serial.println("Starting setup");
  Serial.println("End setup");
}

void loop()
{
  adc.startAsyncSample(channel);
  
  if(adc.asyncResultAvailable())
  {
    int32_t raw = adc.getAsyncValue();
    Serial.printf("Conversion done, result for channel %u : %d, tension : %.2f\n", channel, raw, adc.convertToVoltage(raw));
    channel = channel == 15 ? 0 : channel + 1;
  }
}
