Main Site Documentation

Gadgeteering AnalogInput input, input.ReadProportion()


#1

input.ReadProportion() Is this the same as the current analog.ReadRatio();

Just not sure if they are the same thing.

Edit: I should have asked do they return the same values?


#2

Which specific functions are you referring to?


#3

NetMF 4.3

	private double Read(GTI.AnalogInput input) {
		double total = 0;

		for (int i = 0; i < this.samples; i++)
			total += input.ReadProportion();

		return total / this.samples;
	}

Using TinyCLR 0.6.0
C1analog = ADC.OpenChannel(G400D.AdcChannel.PB16);

    static double ReadsamplesC1(int howmany)
    {
        double total = 0;
        for (int i = 0; i < howmany; i++)
        {
            total += C1analog.ReadRatio();
        }
        return total / howmany;
    }

I had to reload NetMF on my board and it seems both are returning a Ratio of the ADC raw value.


#4

Correct. In TinyCLR, ReadRatio returns ReadValue() / MaxValue. In Gadgeteer, ReadProportion returns ReadVoltage() / 3.3.