G120: How To Access The Analog Pins

Hi Everyone, I am having difficulties accessing the analog pins on a G120. I was wondering which namespace / class I would use to access them.

Try http://docs.ghielectronics.com/tinyclr/tutorials/adc.html

1 Like

Is there any way to write to an Analog Pin (i.e. Sets the voltage on the analog output pin)

Try http://docs.ghielectronics.com/tinyclr/tutorials/dac.html

1 Like

Bauland’s link seems to be exactly what you asked for, but depending on your purposes, you may also be interested in this technique:

PWM to Analog Instructable

A basic RC filter can turn a PWM signal into an analog signal. I’ve never tried this before so I don’t know how easy or hard it is to make it accurate over any given range of duty cycles at any given frequency. It seems the built-in dac also has accuracy issues to consider.

There is an AnalogOutput function.

If you are looking for something with reasonable accuracy, I’d use an external ADC/DAC as the reference is very poor and not stable. It is basically Vdd without any filtering.