How to reference LDR pin in FEZ Cerbuino Bee?


I’m using NETMF and Gadgeteer Package 2014 R1 and VS 2010. I successfully upgraded firmware and managed to blink LED. But how to reference LDR pin using GHI.Hardware.FEZCerb.Pin?

Not 100% sure, but according to the schematics, the loader pin might be on PA10

on a 2nd look in the schematics I see that LDR goes to Loader, which is not Loder1U2.

By this I think you can’t Access it from Software.
Why do you want to read the LDR pin?.
Normally if you pull it up, your SW would not run anyway after restart.

I just follow tutorial in Beginners Guide to C# and the.NET Micro Framework, there is sample program in section 6.2

Did you mean “LED” Pin? You wrote LDR Pin.

I meant LDR, digital input.
LED, digital output, was described in section 6.1.

But the LDR pin is not an Input you can Access from Software.
It’s accessed by the boot loader to see if it should start in loader mode or if your Software should be started.
You can use any other GPIO pin you like as Input.
Do you have a link to your guide? May be I see then what is meant.


Well I might be wrong, and you actually can read the LDR pin.
This guide is from 2012. Means it was written for a FW V4.2.x I guess.
GHI has resorted the libraries in 4.3.
The Pin declarations are now in GHI.Pins.dll
You have to add a reference to this dll, and then add a using statement to GHI.Pins namespace.
But according to the documentation there is no class for Cerb.

But in fact you could use any pin as an input here.
The reason the LDR pin is used might be, that most boards have a button for the LDR pin.

1 Like

Yes, this is for V4.2 version. But even that version of document is outdated, because there is no GHIElectronics.NETMF.FEZ namespace, for example.
The reason I can not update to 4.3 is that I run Windows XP, which prevents me from using VS 2012 and .NET MF 4.3 SDK.

So I think I have to skip this section and figure out, how to read another pins. Thanks anyway.

friends don’t let friends run Windows XP. Please, please upgrade. What is holding you back ?

This is way too old. Use the website documentation instead less.

The ldr pin is not a gpio on cerb.

Hi - I am having a similar issue. Where can I find info on mapping to GPIO on a Cerbuino Bee? Thank link (as someone has pointed out) is from 2012 and their example is no longer any good.

I found GPU.Pins - but there is no type listed for the Bee.

^Gus - where on the web are you talking about? I have looked all over. The schematics aren’t much help by themselves either.

I did find GHIElectronics.Gadgeteer.FEZCerbuinoBee.Pins.D1 - but it throws a ‘System.Exception’ occurred in Microsoft.SPOT.Hardware.dll .

I am trying Cpu.Pin.GPIO_Pin1, but does not seem to work for me. Should it?

@ drbolgioni - ‘Resources’ tab on product page has links to schematics and dev guide

Yes, I have explored that link quite a bit. No mention of GPIO, other than the specs page claims they do exist.

There really is no developer guide either, only a link to some notes about Ethernet and SD card. The schematics are not very clear regarding the IO mapping, I understand they are multipurpose. Either way, I am looking for C# usage.

Have you checked the first tutorial under support? Step number five here .NET Micro Framework – GHI Electronics

Look at Generic class and GetPin method in GHI.Pins, via

This will allow you to reference a pin’s “native” name like PB3, as GetPin(“B”,3);

@ Brett - Yes, came across GetPin() - just took me a little while. I’ll give a try and post my results here. Thank you!

@ Gus - yes. It’s helpful for getting started, but no mention of GPIO.


Using GHI.Pins.Generic.GetPin(‘B’,13) will map to the pin labeled D8 on the FEZ Cerbuino Bee.

            InterruptPort Input1 = new InterruptPort(GHI.Pins.Generic.GetPin('B', 13), false,
                                                    Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeHigh);
            Input1.OnInterrupt += new NativeEventHandler(Input1_OnInterrupt);

Thanks for the help!