Main Site Documentation

Panda LED PWM


#1

I am trying to get the fading LED sample from the beginners manual to work on a Panda.

Here is the code, copied from the intro guide:

using System;
using System.Threading;

using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;

using GHIElectronics.NETMF.FEZ;
using GHIElectronics.NETMF.Hardware;

namespace FEZ_PandaPWMTester
{
    public class Program
    {
    public static void Main()
    {
        sbyte dirr = 1;
        byte duty = 40;

        PWM pwm = new PWM((PWM.Pin)FEZ_Pin.PWM.LED);
            while (true)
            {
                pwm.Set(10000, duty);
                duty = (byte)(duty + dirr);
                if (duty > 90 || duty < 10)
                {
                    dirr *= -1;
                }
                Thread.Sleep(10);
            }
        }
    }
}

On this line:

    PWM pwm = new PWM((PWM.Pin)FEZ_Pin.PWM.LED);

the choices do not include LED and so the code will not even compile. I tried all of the choices and none of them worked. The choice that appears to line up best with the Panda schematic is IO4, but this does not work.

In my references I have

FezPanda_GHIElectronics.NETMF.Fez.

If I change this to FezDomino_GHIElectronics.NETMF.Fez. then I get the LED choice for the pin so I can compile, but it still does not work.

There was a similar post back in the summer but I think my problem is different and I have the updated version of the beginners guide.

Any advice?


#2

Please tag you code so it is readable.

I will check on this but can verify that you can blink led using outputPort?


#3

When you create a new Fez Panda application it includes the code the blinks the LED. This code runs fine and the LED blinks.


#4

ok I checked http://www.tinyclr.com/downloads/Panda/FEZ_Panda_sch.pdf

Unlike Domino, the LED pin on Panda is not connected to PWM pin. There are plenty of PWM so drop an LED on any one of them if you like. Do not forget the 1K current limiting resistor


#5

Thanks.

This was supposed to be just a quick and dirty software test to see how it works.

Might be an idea to update the user guide.