Main Site Documentation

Completely new user - things aren't working


#1

Hello all!
I figured I would try my hands on a duino project for some time now. Being a long time MS Developer, the choice fell on the the .Net gadgeteer simply because it looks like the easiest entry gadget duino clone for a .Net developer.
I’
So I ordered around $160 worth of stuff (Hydra basic kit + a few sensors and a getting started book) .

As mentioned, I am a developer, VS2010 was left behind the moment VS2012 came into existence. Installing the MF was plain forward, as was installing the latest stuff from gadgeteer. The Hydra is found immediately when I plug it in to my computer, but the process of updating the firmware on it required me to short circuit two pins. Not a great experience for first time, but ok, stuff happens.

Now I am stuck in limbo. I do not know what to do - In VS2012, I have only 3 gadgeteer templates, none of which will give me an application. I tried creating a MF application and find gadgeteer libraries to reference, but I’m not sure which ones are required.

Is there an updated tutorial to Gadgeteer for those of us who do not have VS2010? I only need help up to the point where I can get the software to run on the device (and possibly debug it)


#2

Welcome to the forum and Gadgeteer. When you fire up VS2012 and create a Gadgeteer Project you currently see 3 templates, lets start with ‘.Net Gadgeteer Application (NETMF 4.2)’ so give the project a name if you don’t want VS default name and double click on the ‘.Net Gadgeteer Application (NETMF 4.2)’ template. This will create the starting place for your app and put you in the designer, so first thing to check is which mainboard it started you with. If its not a Hydra, simple click on it to select it and delete it and go to the Toolbox and add a Hydra mainboard. Now there should be a tab Program.cs, click on that to add some code, so keeping this really simple we are going to add a timer and a bool and flash the debug led on the mainboard:


using System;
using System.Collections;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Touch;

using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;

namespace HydraTest
{
    public partial class Program
    {
        private GT.Timer _timer = new GT.Timer(1000);
        private bool _flash;

        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
        {
            /*******************************************************************************************
            Modules added in the Program.gadgeteer designer view are used by typing 
            their name followed by a period, e.g.  button.  or  camera.
            
            Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.:
                button.ButtonPressed +=<tab><tab>
            
            If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.:
                GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
                timer.Tick +=<tab><tab>
                timer.Start();
            *******************************************************************************************/


            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");

            _timer.Tick += _timer_Tick;
            _timer.Start();
        }

        void _timer_Tick(GT.Timer timer)
        {
            _flash = !_flash;
            Mainboard.SetDebugLED(_flash);
        }
    }
}

Make sure your Hydra is connected and hit debug, it should compile it, deploy it, and starting running it in debug mode so you can add breakpoint etc and you green led on the Hydra board should start flashing, your first app running.