FEZ Cobra II Seeed Compass

Got a new module in today, all excited to hook it up and go… But no matter what socket I plug it into I get an Invalid Socket Message.

compass = new Compass(4); (I’ve tried 4, 5 and 6). Same message.

Sure looks like it goes into the 4 Socket?

using Gadgeteer.Modules.Seeed;
        static Compass compass;
        public static void Main()

            MainBoard = new GHIElectronics.Gadgeteer.FEZCobra_II();

            compass = new Compass(4);

What am I doing wrong? Feel like I’m going crazy!

Nothing else is plugged in. Get the error on the new Compass line?


Are you using the designer? What sockets does the designer tell you that you can plug it into?

I just created a new Gadgeteer 4.2 app, dragged Cobra II and Compass onto the designer, the only socket it would let me connect it to is 4.

Program Generated code looks like:

    public partial class Program : Gadgeteer.Program
        // GTM.Module definitions
        Gadgeteer.Modules.Seeed.Compass compass;

        public static void Main()
            //Important to initialize the Mainboard first
            Mainboard = new GHIElectronics.Gadgeteer.FEZCobra_II();			

            Program program = new Program();
            program.Run(); // Starts Dispatcher

        private void InitializeModules()
            // Initialize GTM.Modules and event handlers here.		
            compass = new GTM.Seeed.Compass(4);


Build works fine. Can’t run it because I don’t have a compass module :slight_smile:

Yeah I had the same thought. I created a new project and used the designer on this one and was able to get the compass working just fine. However, for the LIFE of me I can’t figure out was is different from my code and the designer code. It must be some library or something.

Or there is some “class” file that I’m not seeing. But I sure don’t think so.

At this point just glad to see it work…

Thanks for the response!!


@ Dan - I believe that your problem is that you are not creating a Gadgeteer.Program instance. This is where the Dispatcher resides and handles all the event coordination. My guess is that there is a dependency in GTM.Module for this to exist and you may be getting a false error.

You are correct! When I was less fuzzy headed and I looked at it this morning, I realized that this was in fact what I was doing wrong.

Now I’m trying to decide what the best approach is, work from the Gadageteer designer generated code and add on there, OR better understand what is going on with “Program” in that class and get it working in my project that I created without the designer.

Now that I’m getting the hang of things, I think it is going to be easier to use the Gadageteer template. As I move forward, is the designer going to cause me any problems if I want to include “premium” things that don’t seem to be covered in the designer?

Or I guess put another way, is there any reason that I should NOT be using the designer?

I am not a hardware guy… Me likes the software So anything that masks CPU pins and a like makes me feel all warm and fuzzy inside


This is actually a hard question to answer. It is related to the question “why do some developers prefer to write and debug programs using the command line instead of a IDE”.

My opinion is… use the designer until you find a reason not to… So far, I have never found a situation where I started a Gadgeteer program with the designer and then had to modify the generated code.

Back in the day, we wrote our programs UPHILL both ways, IN THE SNOW. And, we LIKED it.


AND blindfolded.

Oh, wait, Arduino still does it that way…