AnalogInput with Cerbuino Bee

I create a Gadgeteer 4.2 project and connect the FEZ Connect Shield to Cerbuino Bee.
I want to read the value of E-block sensor.
The AnalogInput code in my domino works well,but I don’t know how transfer it to the Cerbuino Bee.

In my domino code

 static AnalogIn thermometer;
            static AnalogIn lightSensor;            
            thermometer = new AnalogIn((AnalogIn.Pin)FEZ_Pin.AnalogIn.An2);
            thermometer.SetLinearScale(-22, 56);
            lightSensor = new AnalogIn((AnalogIn.Pin)FEZ_Pin.AnalogIn.An3);
            lightSensor.SetLinearScale(0, 100);

I modify it to Cerbuino Bee:

AnalogIn thermometer;
            static AnalogIn lightSensor; 
            thermometer = new AnalogInput((Cpu.AnalogChannel)GHI.OSHW.Hardware.FEZCerbuino.Pin.AnalogIn.A2);
            thermometer.SetLinearScale(-22, 56);
            lightSensor = new AnalogInput((Cpu.AnalogChannel)GHI.OSHW.Hardware.FEZCerbuino.Pin.AnalogIn.A3);
            lightSensor.SetLinearScale(0, 100);

But VS shows that does not contain the SetLinearScale method.

What class I am missing? or what namespace or reference do I need to add?

Taking a guess here, your domino board is NetMF 4.1? i believe analog in was part of GHI’s premium libs at 4.1 but it is now part of core NetMF and the implementation of it is inevitably slightly different you need to use .scale and .offset.

So you will need something along the lines of

thermometer.Scale ( (22+56)/pow(2,thermometer.Precision))
thermometer.offset (-22)


Thanks Timmyag
But needs set to


And where do you find that how to set the value of Scale and Offset?


The value of thermometer is not correct.
Does anyone can help me to set the Scale and offset?
Thank you