24 float v[samples_] = {0.f};
25 for (
int i = 0; i < samples_; ++i) {
29 return median(v, samples_);
float read_voltage(ADCChannel ch)
Read voltage from ADC channel (computes voltage using the set fixed gain)
float read_voltage()
Read voltage from ADC for LDR. Make sure ADC is initialised before calling this method.
LDR(int samples, ADC *adc)
Construct a new LDR object.
float median(float *arr, int size)
Calculate median of a float array.