Main Site Documentation

Blink led on a Cobra II running 4.3 assemblies?


#1

Hey guys,
According to the G120 manual, this code should work, but does not.
I was able to blink the led in 4.2, but no luck since updating to 4.3

   public static void Main()
    {
     // OutputPort LED = new OutputPort(Cpu.Pin.GPIO_Pin0, false);
        OutputPort LED = new OutputPort(G120.P0_17, true);
        Thread.Sleep(200);

        for (int i = 0; i < 200; i++)
        {
            LED.Write(true);
            Thread.Sleep(200);
            LED.Write(false);
            Thread.Sleep(200);
        }

Here is the snippet from the G120 manual:
https://www.ghielectronics.com/downloads/man/G120_User_Manual.pdf

using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using GHI.Pins;
public class Program
{
public static void Main()
{
OutputPort LED = new OutputPort(G120.P0_17, true);
while (true)
{
LED.Write(true);
Thread.Sleep(500);
LED.Write(false);
Thread.Sleep(500);
}
}
}

Any thoughts are appreciated.


#2

Most likely you do not have the right pin specified.

Are you trying to use the LED on the board?

Have you tried to use a pin specification from the GHI.Pins namespace?


#3

According to the schematic the LED is on P1_15

Looks like GHI needs to update the manual :slight_smile:


#4

whoops … This may not be clear, but examples in that manual are not for Cobra II; they are for G120 SoM. In the example sited, the assumption is that the designer has attached an LED to the GPIO pin.


#5

on the other hand, i’ll investigate the use of the generic netmf pin.


#6

@ Larry1 -

Was this something you tried when investigating 4.3


#7

Jeff, yes sir

I tried both definitions in my attempt to blink the LED.
OutputPort LED = new OutputPort(Cpu.Pin.GPIO_Pin0, false);
and
OutputPort LED = new OutputPort(G120.P0_17, true);
Neither definition would change the state of the LED
If you can tell me the pin number of the LED on the Cobra II, i will try again.
Thanks for the quick reply.

Mike & Dave,
Thanks for the good suggestions and thoughts.
I am trying to drive the LED on the Cobra II.


#8

@ Larry1 - Look for the board LED on the schematic. it will tell you which pin to use.

I could tell you which pin, but someone has already posted it. Regardless, check out the schematic.


#9

Mike, Will do tonight. Thanks, Larry


#10

Thanks Guys, I must admit that I seldom think about looking at the schematic. I figure the board s already build so why do I need the schematic! Wrong! A lesson learned for the future! Larry Scott