.NET Gadgeteer Hello BizVise Project – Part 3: Toggling LED strip of .NET Gadgeteer

Well, in this blog post I will try to hook up my Push Button and also the LED Strip that come with my FEZ Raptor Starter Kit. Will demonstrate how I fix the modules and write a simple code that runs on FEZ Raptor to toggle LEDs based on the push button input. Below are the steps taken, enjoy!

1. First, connect the Push Button module X connector to FEZ Raptor connector X (number 2). Then, connect the LED Strip Y connector to FEZ Raptor connector Y (number 1). You may refer the photo taken below for the wiring.

LED Strip Toggle and Push Button Connection on FEZ Raptor .NET Gadgeteer

2. Next, setup the Visual Studio project connection according to the physical connection done in Step 1. The video below shows how I did it.

3. Once we have the project setup correctly, next is to write the code that toggle the LED Strip based on the push button input. Below is the video guide and also code snippet (in case following video guide is not your cup of tea).

namespace HelloBizVise.NETMF
{
    public partial class Program
    {
        private bool isLEDON = true;

        void ProgramStarted()
        {
            Debug.Print("Program Started");

            ledStrip.TurnAllLedsOn();
            isLEDON = true;

            bToggle.ButtonPressed += bToggle_ButtonPressed;
        }

        void bToggle_ButtonPressed(Button sender, Button.ButtonState state)
        {
            if (isLEDON)
            {
                ledStrip.TurnAllLedsOff();
                isLEDON = false;
            }
            else
            {
                ledStrip.TurnAllLedsOn();
                isLEDON = true;
            }
        }
    }
}

If everything done correctly, we are ready to run the application on FEZ Raptop. Here’s what I get. 🙂

Toggline LED with push button on .NET Gadgeteer (Guide) - 2

Just as a preview of what coming up next 🙂 – Part 4 https://bizvise.com/2014/05/05/net-gadgeteer-hello-bizvise-project-part-4-graphical-user-interface-gui/

FEZ Raptor with Touch LCD

Advertisements

2 comments

  1. Pingback: .NET Gadgeteer Hello BizVise Project – Part 2: Setting up Visual Studio IDE for NETMF Development « BizVise

  2. Pingback: .NET Micro Framework User Interface Development Framework Review « BizVise


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s