Main Site Documentation

Accessing ALL/MOST GPIO through Visual Studio


#1

i am sorry but i am still unclear, how i would go about programming for a custom board that exposes GPIOs that are not available on any of the boards,

In visual studio, i tried “Usbizi” project and the following code is not even supported.

 OutputPort test = new OutputPort((Cpu.Pin)4, true);

and then when i go to a “Domino” application and that works fine ,
but it does not have “71” options for GPIOs only the ones that are available on the board which is obvious since its a "Domino " project…

so that is my question, if have a board where i expose most GPIOs how do i access them through Visual studio?

this is why i was thinking i have to edit the hardware provider class to “Add” the additional pins i am exposing. but .NETMF has close to nothing when it comes to online documentation and resources… not very hobby friendly. all i have is a book that skimmed through the process.


#2

You would want to do something like

OutputPort test = new OutputPort(GHIElectronics.NETMF.Hardware.USBizi.Pin.IO20, true);

#3

does not exist in GHI.electronics namespace


#4

would that be in a “domino” project or a “Usbizi” project because in the domino project…Hardware does not exist in GHIElectronics.NETMF namespace even if i refrence it… and in a USBizi project OutputPort does not exist…


#5

Microsoft.SPOT.Hardware


#6

nothing…


using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using GHIElectronics.NETMF.Hardware;

namespace USBizi_Application1
{
    public class Program
    {
        public static void Main()
        {
            OutputPort test = new OutputPort(GHIElectronics.NETMF.Hardware.USBizi.Pin.IO20, true);
        }

    }
}

that in a “USBizi” project gives me"The type or namespace name ‘OutputPort’ could not be found (are you missing a using directive or an assembly reference?) "


#7

further more in a regular “Domino” project the follwoing code does not work either


using System;
using System.Threading;

using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;

using GHIElectronics.NETMF.FEZ;
//using GHIElectronics.NETMF.Hardware;
namespace FEZ_Domino_Application1
{
    public class Program
    {
        public static void Main()
        {
            // Blink board LED

           

            OutputPort test = new OutputPort(GHIElectronics.NETMF.Hardware.USBizi.Pin.IO20, true);

          
        }

    }
}

this time it says "Hardware does not exist in GHI…NETMF namespace …


#8

Microsoft.SPOT.Hardware.OutputPort it’s there; did you add the reference to the project?


#9

yes it is referenced but the IDE insists its not there


#10

Eddie, you must add the reference, the using statement does not add it.

You must rigth click on references tab on the panel, then click add and select the reference manually.


#11

Ah!!! I was assuming that was the case in which “using” referenced it, now i know!! Pablo and all the others thank you for the assistance and your persistence .


#12

Just to be clear -

‘Adding a reference’ means telling the IDE that your project will be using some external code.

Adding a ‘Using directive’, i.e.

using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using GHIElectronics.NETMF.Hardware;

…tells the compiler that THIS file will be using those namespaces.

A ‘reference’ is a DLL that may contain one or more namespaces, so it is not enough to do just one or the other of the steps above. You have to tell Visual Studio where the external dll is that you want to add to the project (adding a reference) and you also have to tell it which namesopaces you will be using in each file.

Think of it like you have many file cabinets each containing many files. You can’t just tell someone to go get you a certain piece of paper, you have to tell them in which file cabinet (reference) and which file (namespace) to find that paper (bit of code you want to use.)


#13

In other words do you see it under the References node in the solution explorer?


#14

yes Architect it works now!!

the file cabinet metaphor , i like that.

It was driving me cray for a while i was starting to resemble the cat in Jeff’s avatar. Its almost embarrassing how simple the solution was. anyhow thanks again.