Fez Cerberus - how to use AnalogOut

Hi,

I’ve tried to use Socket 4 Pin5 analog out to light a LED.

_analogOut = extender.SetupAnalogOutput(GT.Socket.Pin.Five);

Return me the error:

“Socket 4 has an error with its Analog Output functionality. Please try a different socket.”

I downloaded Gadgeteer source code and debugging I’ve found the following:

 #region Socket 4
...
...
// O
            socket.AnalogOutput = new FEZCerberus_AnalogOut((Cpu.Pin)0); 

I’ve changed it according Cerberus pin docs in:

socket.AnalogOutput = new FEZCerberus_AnalogOut(GHI.OSHW.Hardware.FEZCerberus.Pin.PA5);

and error has gone… but nothing happened!

Continuing debugging I found:

 public void SetVoltage(double voltage)
        {
            Active = true;

            // Check that voltage does not fall outside of mix/max range
            if (voltage < _minVoltage)
                throw new ArgumentOutOfRangeException("The minimum voltage of the analog output interface is 0.0V");

            if (voltage > _maxVoltage)
                throw new ArgumentOutOfRangeException("The maximum voltage of the analog output interface is 3.3V");

            // Use the mainboard-specific analog
            // aout.Set(voltageInUnits);

            
        }

Method is not implemented yet?!?!

@ danyolgiax - You need to use a Digital pin not analog.

ok… you are right… but I dont’t have now a resistor for my LED so I’d like to try to light it direclty with 1.8V from analogOut.

Analog out us a signal. It can’t drive LEDs.