G400HDR Onboard LED D1

I realize “There is no guarantee on functionality.”

That said, I still have a question. It boils down to if I have the correct CPU Pin selected (if the onboard D1 Led is implemented in the firmware).

It does not matter if it works or not . I wanted to double check if I am doing it correctly.

G400-D. Pin 147, PD3 (The Pinout does not show any information)
Reference D1/R11 JP2_14-PD3 Shown in G400HDR_Breakout_SCH.pdf.

There is a physical connection from D1 - R11 to PD3 - I have no idea if JP2_14 - PD3 is really connected to Pin 147 of the G400-D.

Cpu.Pin PD3 = (Cpu.Pin) (3*32+3);

Port D, (A=0, B=1, C=2, D=3). Therefore 3[D] * 32 + pin number [3].
The IO pin I needed is PD3 - (3[D]*32 = 96 + 3) is (CPU.Pin)99

 //#### Exception System.Exception - CLR_E_PIN_UNAVAILABLE (1) ####
 D1LED = new OutputPort((Cpu.Pin)99, true);

Sorry to bother on a simple thing but I wanted to be sure I was using the correct method to access the LED D1.


That is correct.

Here is a different way to access the pins with the enumeration: https://www.ghielectronics.com/docs/112/g400#1743

@ willgeorge -

By the way the

//#### Exception System.Exception - CLR_E_PIN_UNAVAILABLE (1) ####

is because you are using G400HDR Gadgeteer Mainboard class and it is already reserved that pin

// change the below to the debug led pin on this mainboard

        private const Cpu.Pin DebugLedPin = GHI.Hardware.G400.Pin.PD3; //GHI.Hardware.G400.Pin.PC4;

       private Microsoft.SPOT.Hardware.OutputPort debugled = new OutputPort(DebugLedPin, false);

        /// <summary>
       /// Turns the debug LED on or off
       /// </summary>
       /// <param name="on">True if the debug LED should be on</param>

        public override void SetDebugLED(bool on)

@ Aron -

Thank you…

I saw that information and I cannot use:

OutputPort G400HDR_LED = new OutputPort(Pin.PD3, false);

I receive: Error 1 The name ‘Pin’ does not exist in the current context.

I believe this error is because I am using dotnetwarrior.Gadgeteer.G400HDR. (Which I like)

I am forced to use (Cpu.Pin)some pin number.

@ Architect -

Thanks I’ll give it a try…
In my post I should have mentioned that I am using dotnetwarrior.Gadgeteer.G400HDR because I like it…

1 Like

You would be missing this then…

using GHI.Hardware.G400;

@ Brett -


You are 100% CORRECT!

I had:

using G400 = GHI.Hardware.G400; //FEZ Hydra

I should have used:

OutputPort G400HDR_LED = new OutputPort(G400.Pin.PD3, false);


OutputPort G400HDR_LED = new OutputPort(Pin.PD3, false);

Rough getting old!

At least I got the LDR0 and LDR1 button events on my own…

Thanks to all!