Using AnalogOutput on Cobra 2

I have both cobra and cobra 2 boards. I use 4.1 for cobra and 4.2 for cobra 2.
On cobra, I was able to do all the analog input and output by using GHIElectronics.NETMF.Hardware. I tried to do the same thing on cobra 2, but it doesn’t work. I know that, I can not find similar one in GHI.Premium.Hardware.
Could you guys helps me with this. I want to use some methods like setLinearScale() or set().
Thank you very much

@ snoopy274 - Welcome to the forum. Both AnalogInput and AnalogOutput are part of the NETMF 4.2 now. AnalogInput is documented in new documentation:

AnalogOutput is missing in the docs, but it is there in the assembly Microsoft.SPOT.Hardware. You can see it in Object Browser in the VisualStudio.

You can use Scale property for both classes to set the scale.

Thank you for your reply.
I am really new with this stuff. Could you give me an example of how to use Scale.

Based on documentation for Read method the value is modified:

result = raw * alpha + K

Scale property is alpha in this formula and Offset is K.

There is also precision property for the port.

For example with 10bit ADC (Precision is 10)

You can read values in the range of 0-1023. That what ReadRaw will return to you.
You can set Scale to 1/1023 and Offset to 0 then Read method will return values between 0.0 and 1.0
Set Offset to 1.0 and then Read will return values between 1.0 and 2.0

Same applies to Write and WriteRaw.

I got it. Thank you very much.

You are welcome!