New to C Sharp and Panda Question

Just got my panda and I’m going thru The Beginners guide. Right now I’m trying to light a LED but can’t get it to work?


using System;
using Microsoft.SPOT;
using System.Threading;
using Microsoft.SPOT.Hardware;
using GHIElectronics.NETMF.FEZ;

namespace MFConsoleApplication1
{
public class Program
{
public static void Main()

    {
     
        OutputPort: LED;
        LED= new OutputPort((Cpu.Pin)4, true);

        Thread.Sleep(Timeout.Infinite);

            
    }

}

}


but I cant get it to recognize “LED” ?

The error = “The name ’ LED’ does not exist in current context”

Can anyone tell me what I’m not including?
How do you find out what is included in the different librarys?

Really appreciate some help,

An ignorant beginner - JohnBoy

please post your complete code.

Please copy and paste the code from VS here. May be you are using mixed case on the variable names ?

Copy/paste the code from the book ASIS.

The colon here (after “OutputPort”) is generating the syntax error:


OutputPort: LED;
LED= new OutputPort((Cpu.Pin)4, true);

Get rid of the colon and you should be good to go.

That helped, my printer made what looked like a “:” in my copy of the beginners guide.

Now I get…

An unhandled exception of type ‘System.InvalidOperationException’ occurred in FEZPanda_GHIElectronics.NETMF.FEZ.dll

Additional information: FEZ Panda not detected!

Wmissing now?

Thanks again,

Johnboy

Forget about Panda for a second.

  1. Did you start with emulator and made new project and made sure it worked fine on emulator?
  2. Did you follow the firmware update video and made sure you have the latest firmware?
  3. Did you start a new project with the FEZ Panda template?
  4. If no template then copy the example from the book as is, try to compile it…Hit F6
  5. If it compiles with NO errors then you can connect Panda and try to load the software to it…as detailed in the book.

FEZ is really easy but the first day you have it you really need to follow the first few pages of the book very precisely. Once you can blink an LED then everything after flows smoothly.

Make sure your project is configured to deploy to the actual device rather than the emulator. Right-click on your project in the solution explorer. Go to Properties -> .NET Micro Framework. Make sure “USB” is selected under “Transport”, and select your device from the drop down.

Yeah, what Gus said :slight_smile:

[quote]LED= new OutputPort((Cpu.Pin)4, true);
[/quote]

You should not be using the actual Cpu.Pin number. Pin 4 most likely is not the LED.

Look at the ebook and see how the FEZ pins are specified. You should be able to find on for the LED.

Actually, if you create a project for the Panda, the proper reference will be set, and the code included for toggling a LED.

Thanks to everybody for your help, the colon was the problem plus I forgot that I started a new project and let it default to emulator. I’m going to fall back and start with pinging and try again.

Thanks to all …

Oh boy, I guess I need a new monitor :frowning: I did not even noticed the :

Sorry to keep with the dumb questions but now I can’t ping?

Earlier I have successfully run mfdeploy and it did the ping OK. Now I try it and there is nothing in the device box . I updated the firmware using teraterm and I can talk to the board and it will give me the version number back etc… I choose USB and the device box comes back blank?

You might try to upload the firmware again. If it failed to install correctly your stuck with a virtual serial port.
So, reset with the LDR button pressed. Upload the firmware again and wait until you see a confirmation that the upload was a success.

Thanks, I finally got got the firmware to reload. I think my problem is that I am using a 10 yr old box running XT. It really boggs down and I might be getting impatient.

Thanks again,

John