DrNick
April 26, 2011, 8:35am
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?
Gralin
April 26, 2011, 8:41am
2
Look at this thread, maybe something there will help:
[url]http://www.tinyclr.com/forum/2/2393/[/url]
DrNick
April 26, 2011, 10:36am
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);
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
DrNick
April 26, 2011, 11:46am
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]