Thursday, March 3, 2011

Simple Netduino plus example

Time for your first Netduino plus project. Let's build a very basic example to make sure everything is working correctly. If you have not installed all the software yet, see my previous blog post on how to setup your development environment.
  • Launch Visual Studio
  • Choose to create a new project
    • Select "Netduino Plus Application" and name the project "NetduinoPlusSimpleExample".
    • Enter the following code in the Main method
      • On line #3 we declare the on-board LED as an output port. The second parameter we set the default value to "false" (low or off).
      • Then we create an infinite loop.
      • Inside the loop on line #6 we write to the on-board LED true (high or on).
      • Line #7 we pause the application for one second
      • Then we turn off the LED for one second.
      • This loop will continue until you reset the Netduino plus or upload another program.
    public static void Main()
            {
                OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);
                while (true)
                {
                    led.Write(true);
                    Thread.Sleep(1000);
                    led.Write(false);
                    Thread.Sleep(1000);
                }
            }
    


    • Now that we have the program written we are going to upload it to the Netduino. Attach a mini-USB cable to the Netduino plus and plug into a USB port. If you receive a driver error you must confirm or re-install the Netduino drivers.
    • Now we need to tell Visual Studio to run the program on the Netduino plus board and not the emulator. I have not found the emulator to be very useful as it does not display any outputs.
    • Right click on your project "NetduinoPlusSimpleExample" > "Properties"
    • Select the ".Net Micro Framework" tab and change the following settings.
      • Transport: USB
      • Device: NetduinoPlus_NetduinoPlus
    • Save your changes
    • Let's run the program. Select "Debug" > "Run" or F5
    • Here is a video of the program running on my Netduino plus

    • Download the complete project

    9 comments:

    1. Orang-orang di seluruh dunia telah mempraktikkan pertanian selama ribuan tahun. Saat ini, melalui inovasi pertanian modern dan teknologi ilmu tanaman, Kanada telah mampu menumbuhkan beberapa hasil panen tertinggi di dunia, memberi kami keunggulan kompetitif secara global. cek juga cara budidaya ikan gabus di kolam terpal dan yukusaha

      ReplyDelete
    2. Are you in need of a reliable garage door service that is affordable as well? Rafael Garage Door is your Local Garage Door maintenance provider and we are one-stop-shop for all Garage Door Repair Northwest Tampa services.

      ReplyDelete
    3. Are you trying to get your garages fixed and repaired but you still have not gotten the best work out of the businesses you have reached out to so far? If so, tGarage Door of Southfield is a company that is ready to work for you today. Our Michigan men are some of the top technicians in the business.

      ReplyDelete
    4. Garage Door of Canton MI is here to help you with your Garage door repairs whether that be for a home or commercial space. A working garage is something that every homeowner needs.

      ReplyDelete