FEZ DOMINO analog out

hi guys, I have not been able to get a signal out of the analog out port (An3 port). I’m using an oscilloscope to measure from An3 to GND and i still have no results. please help.

code:


        public static void Main()
        {
            // Blink board LED

            bool ledState = false;

            ///////////////////////////////////////////////////////////////////////////////
            //Setup buffer for DSP calculations

            int[] Reg_Buffer;
            Reg_Buffer = new int[2500];

            AnalogIn BatteryVoltage = new AnalogIn((AnalogIn.Pin)FEZ_Pin.AnalogIn.An0);
            BatteryVoltage.SetLinearScale(0, 3300);

            //for (int i=0; i<2499; i++)
            //{
            //    int voltage =BatteryVoltage.Read();
            //    //sleep for 3 ms
            //    Thread.Sleep(3);
            //    Reg_Buffer[i] = (voltage/1000);
            //}

          
            ////////////////////////////////////////////////////////////////////

            ///////////////////////////////////////////////////////////////////////
            //Setting up analog out

            AnalogOut VoltLevel =
            new AnalogOut((AnalogOut.Pin)FEZ_Pin.AnalogOut.An3);
            VoltLevel.SetLinearScale(0, 3300);
          ////////////////////////////////////////////////////////////////////////

            //////////////////////////////////////////////////////////////////////
            //difference(ref Reg_Buffer);
            //square(ref Reg_Buffer);
            //integral(ref Reg_Buffer);
            //display(ref Reg_Buffer, ref VoltLevel);

                ////////////////////////////////////////////////////////////////////////

                ///////////////////////////////////////////////////////////////////////
                OutputPort led = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, ledState);

                // create serial port for bluetooth . Connect BLUETOOTH_RX to Di8 and BLUETOOTH_TX to Di7.
                SerialPort bluetooth = new SerialPort("COM1", 9600, Parity.None, 8, StopBits.One);
                bluetooth.Open();

                while (true)
                {
                    // create heart rate information bytes
                    byte[] helloBytes = Encoding.UTF8.GetBytes("1");

                    bluetooth.Write(helloBytes, 0, helloBytes.Length);
                    //////////////////////////////////////////////////////////////////////////////////////////////////

                    VoltLevel.Set(1000);


                    //// toggle LED state
                    ledState = !ledState;
                    led.Write(ledState);
                    //sleep for 3 ms
                    Thread.Sleep(2000);
                    VoltLevel.Set(0);
                }

           

            
        }
        
    }

Keep it simple, remove all unrelated code and only set the analog output then measure it with a volt meter.

The voltmeter reads -4.67 volts (strange).

code:


public static void Main()
        {
            // Blink board LED

            bool ledState = false;

           

            AnalogIn BatteryVoltage = new AnalogIn((AnalogIn.Pin)FEZ_Pin.AnalogIn.An0);
            BatteryVoltage.SetLinearScale(0, 3300);

         

            ///////////////////////////////////////////////////////////////////////
            //Setting up analog out

            AnalogOut VoltLevel =
            new AnalogOut((AnalogOut.Pin)FEZ_Pin.AnalogOut.An3);
            VoltLevel.SetLinearScale(0, 3300);
          ////////////////////////////////////////////////////////////////////////

          
           ///////////////////////////////////////////////////////////////////////
            OutputPort led = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, ledState);

              
                while (true)
                {
                    

                    VoltLevel.Set(1000);


                    //// toggle LED state
                    ledState = !ledState;
                    led.Write(ledState);
                    //sleep for 2s
                    Thread.Sleep(2000);
                    VoltLevel.Set(2000);
                }

           

            
        }

Okay i got it working. how do i see what the code below is outputing? the fez domino has no screen (confused).

code:

Debug.Print("Voltage = " + (voltage / 1000).ToString() + "." + (voltage % 1000).ToString());

These messages are displayed in the output window of visual studio during debugging.

im sorry i know this might sound foolish but how do i get the output window to show?

Ctrl+w, o

You can also view the Debug.Print statements in MFDeploy, if you are not running the app under debugger in Visual Studio.

Watch out with analog input if it comes to voltage!!! Never exceed 3.3v on analog in.
(I can’t say it often enough)

If you need help, here is how I did it:

http://robertjacobs.eu/2011/02/03/voltage-dividing-reading-battery-voltage/

A lot of people reading battery voltages lately :o

im trying to sample a signal and output it through An3 in real time. im getting a quantized signal.

code:

public static void Main()
        {
            // Blink board LED

            bool ledState = false;

            ///////////////////////////////////////////////////////////////////////////////
            //Setup buffer for DSP calculations

            AnalogIn BatteryVoltage = new AnalogIn((AnalogIn.Pin)FEZ_Pin.AnalogIn.An0);
            BatteryVoltage.SetLinearScale(0, 3300);

            ////////////////////////////////////////////////////////////////////

            ///////////////////////////////////////////////////////////////////////
            //Setting up analog out

            AnalogOut VoltLevel =
            new AnalogOut((AnalogOut.Pin)FEZ_Pin.AnalogOut.An3);
            VoltLevel.SetLinearScale(0, 3300);
            ////////////////////////////////////////////////////////////////////////



            ///////////////////////////////////////////////////////////////////////
            OutputPort led = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, ledState);

          
            int voltage = 0;
            while (true)
            {
               
            /////////////////////////////////////////////////////////////////////////////////////////////////////


                voltage = BatteryVoltage.Read();
                //// toggle LED state
                //ledState = !ledState;
                //led.Write(ledState);
                //sleep for 3 ms
                Thread.Sleep(2);
                VoltLevel.Set(voltage);
                Thread.Sleep(1);
            }




        }

NETMF is not real time but you can use the tasking we offer in RLP. That is real time