Main Site Documentation

First step(Digital Outputs)


#1

I have Cerberus and connect on 7 port LED7R. I want through method “Digital Outputs” Light Up an LED.
I saw lesson https://www.ghielectronics.com/docs/7/digital-outputs, but does not work.
Name Pin on board: PC4
Module LED7R: PC9

Code:

OutputPort LED;
LED = new OutputPort(Pin.PC4, true);
//LED = new OutputPort(Pin.PC9, true);
while (true)
{
LED.Write(true);
Thread.Sleep(200);

            LED.Write(false);
            Thread.Sleep(200);
        }

The LED in off all the time; What the problem?

VS2012
firmware: 4.2.6.1


#2

Pin 9 on socket 7 on Cerberus is PC12.

Here is the link to schematics.


#3

I see, and use pdf, but don’t work


#4

Hi Magals, welcome to the forum.

Can I ask why you’re making this first project so hard? One of the Gadgeteer benefits is you don’t need to know this stuff.

Create a new project - select a Gadgeteer project.
Drag a Cerberus mainboard in or choose it as part of the setup.
Drag a LED7R from the toolbox.
Wire the 7R to the Cerb on a valid port.

In your code, use the TurnLightOn() method to enable a light.

That will prove everything you have connected is working.

Then you can get into a project that uses digital input/output separately, but you’ve proven everything that you have is working as expected.


#5

I have already done about what you say. all works.
now I’m studying GPIO and how it works.


#6

ok, great, that helps.

From here, I would use the codeplex site to look at the mainboard and module code.

From that you can see the pin definitions on Socket 7 map to:

 #region Socket 7
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(7);
            socket.SupportedTypes = new char[] { 'F', 'Y' };
            socket.CpuPins[3] = FEZCerb_Pins.PA15;
            socket.CpuPins[4] = FEZCerb_Pins.PC8;
            socket.CpuPins[5] = FEZCerb_Pins.PC9;
            socket.CpuPins[6] = FEZCerb_Pins.PD2;
            socket.CpuPins[7] = FEZCerb_Pins.PC10;
            socket.CpuPins[8] = FEZCerb_Pins.PC11;
            socket.CpuPins[9] = FEZCerb_Pins.PC12;

The module: http://gadgeteer.codeplex.com/SourceControl/latest#Main/Modules/GHIElectronics/LED7R/Software/LED7R/LED7R_42/LED7R_42.cs

From the code for the module, you can see that the LEDs are on pins 3 through 9. so you can try setting all those on, waiting some time, setting them all off again, to prove that this works. My cerb had an accident yesterday so I can’t prove that, but here’s how I tested…

Create new project, a netmf console project.
Change target framework to 4.2 (since I’m using VS2012)
Add references to GHI.Hardware.FezCerb, GHI.OSHW.Hardware, Microsoft.SPOT.Hardware.

Then in main() I simply declared some output port pins:

            OutputPort LED_a = new OutputPort(GHI.Hardware.FEZCerb.Pin.PA15, false);
            OutputPort LED_b = new OutputPort(GHI.Hardware.FEZCerb.Pin.PC8, false);
            OutputPort LED_c = new OutputPort(GHI.Hardware.FEZCerb.Pin.PC9,false);

hope this helps?