Main Site Documentation

Distinguish between EXM and Cobra


#1

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?


#2

Look at this thread, maybe something there will help:

http://www.tinyclr.com/forum/2/2393/


#3

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

See R8 on the left


#4

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);


#5

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


#6

You should declare the pin with pull up and read it

1 = EMX
0 = cobra


#7

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]