Distinguish between EXM and Cobra

I realise that the Cobra uses the EMX board, and do they are essentially the same thing, but I was hoping to find a way to distinguish between them in my code.

GHIElectronics.NETMF.FEZ.FEZ_Type HardwareModel = GHIElectronics.NETMF.FEZ.FEZ_System.GetSystemType();

This code returns 3 (= Cobra) when run on my EMX board. Is there anyway to tell them apart?

Look at this thread, maybe something there will help:

[url]http://www.tinyclr.com/forum/2/2393/[/url]

http://www.ghielectronics.com/downloads/FEZ/Cobra/FEZ%20Cobra_sch.pdf

See R8 on the left

I see, that should be exactly what I’m looking for. However, I’m not sure how to read the value of the resistor?

I tried to set an InputPort to that pin, but in doing that you have to declare what state the resistor is.


InputPort newPin = new InputPort(EMX.Pin.IO21, true, Port.ResistorMode.PullDown);

This also doesn’t run:


AnalogIn CobraEmxDetect = new AnalogIn((AnalogIn.Pin)EMX.Pin.IO21);

Use it exactly as in Rhino case ( the thread that Gralin has mentioned ) with the appropriate pin number.

You should declare the pin with pull up and read it

1 = EMX
0 = cobra

So in fact all that’s needed to test between EMX and Cobra is the following:

InputPort newTestPin = new InputPort(EMX.Pin.IO21, true, Port.ResistorMode.PullUp); // IO21
Boolean EMXorCOBRA = newTestPin.Read();

True is an EMX and False is a Cobra

Thank you Gus! That was what exactly I needed to know. Phew, now I can code separate for my EMX development board and the Cobra deployed device (off site).

[Could someone with a Cobra just check this comes out False as I don’t have one to hand]