Panda II eblock button

In the program, I have an e-block button on An3, and an e-block LED on An2. What I would to do, is by pressing the button, it turns on the LED, and by releasing the button, it would turn off the LED. Later I will add a timing function, which will tell me how long the button was pushed.

I looked at some examples, but they do not show how to implement (Cpu.Pin)FEZ_Pin.Digital.An3. I guess I need some suggestions as to how to implement the e-block button, in order to make the program work.

Thanks

[CODE]
using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;

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

namespace TestThread1
{
public class Program
{
static OutputPort MyLEDr = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.An2, true);
// static InputPort[] MyButton = new InputPort[3]; ???

    public static void Main()
    {
        

        while (true)
        {
            offLED();
            onLED();
        }          
    }

    public static void onLED()
    {
        MyLEDr.Write(true);    // LED is on
        Thread.Sleep(300);
    }

    public static void offLED()
    {
        MyLEDr.Write(false);   // LED is off
        Thread.Sleep(300);
    }

}

}
[/CODE]

Have you looked at digital input tutorial? Support – GHI Electronics

[url]http://wiki.tinyclr.com/index.php?title=Digital_Inputs_-_Buttons[/url] is the best example to look at - it has exactly what you want.

Bret I did not look at your suggestion, just yet. Below is my interpretation of how it should work, and it actually does what I want it to do, for this example anyway. I am hoping that one of the gurus here, will add their suggestion(s).

Now I will try to work in a timer for the button press, but I need to implement the FEZ touch some how, any hints?

[CODE]
using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;

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

namespace TestThread1
{

public class Program
{
    public static void Main()
    {
        OutputPort LED;
        InputPort Button;

        // LED inits to OFF
        LED = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.An2, false);  // e-block LED
        Button = new InputPort((Cpu.Pin)FEZ_Pin.Digital.An3, false,
                               Port.ResistorMode.PullUp);  // e-block button
        
        while (true)
        {
            // If button is pressed
            if (Button.Read() == false)  // false = not pressed
                // Turn on the LED e-block
                LED.Write(true);
            // If button is released
            if (Button.Read() == true)  // true = pressed
                // Turn off the LED e-block
                LED.Write(false);
            Thread.Sleep(10);
        }
    }
}

}
[/CODE]

I can understand your state

1.You have used another processor in the past
2.You have a full kit of a FEZ board, shield, eblocks
3.You are overwhelmed at this point, you want to do everything at the same time (excited)
4.You feel let down when something does not happen

Most of us have been at this point and with platforms that were primitive or convoluted.

Please take our pointers in a good sense and you will be cruising pretty soon.

1.Please work through the Beginners Guide to .NET Micro Framework and the Internet of things
2.Try to read system time
3.Try to read the difference between 2 time values
See : DateTime Members | Microsoft Learn

I would advise waiting a little bit to start with the FEZ touch, but if you want to jump in to see something on the LCD go here

http://code.tinyclr.com/project/277/fez-touch-lcd-component/

There is code for all sorts of things there

Is their a time limit when you are writing a reply? I was doing a reply, and when I finished, I was logged out with the reply not appearing. Or it must be something that is monitoring my reply, and not liking what I was writing LOL.

You must have said something horrible about my post :smiley:

The inivisible “FEZ Monkey” must have protected me from that post :smiley:

No, it was not anything horrible, I was just responding to some of your points. I did mention something that GHI might consider doing, maybe that was it.