(Fez Spider with extender module) don't know how to define pins? Thx for your help

I have a FEZ Spider and want to use an analog input with an extender plugged in Port 9 but i don’t know how to define these pins i want to use. Do you have any idea?

Greetings Niklas

Keep this in your back pocket :slight_smile:

Welcome to the community!

Thank you for your quick help:-)
My Problem is that i don’t know to define Socket 9 as A and than the pins to Analoginput and digital IN/OUT

I believe that you can define it as an extender modulem, then link to the pins.

The way I have been using pins is so:

GT.Socket mySocket = GT.Socket.GetSocket(9, true, null, null); 

GT.Interfaces.AnalogInput myAnalogueInput = new GT.Interfaces.AnalogInput(mySocket,GT.Socket.Pin.Three,null);

you can then call myAnalogueInput.ReadVoltage etc.

@ Molando, please use “code” tags. That should do it for you coxxxer.

Thank you Molando
thats exactly what i wanted to know:-)
but "(9, true, null, null); "
9 = Port 9 , but the true and null , null i don’t know why?

For digital input/output on a single pin you have two options that I know of.

You can define the pin as a tristate pin. They say to be careful about this. With a tristate you can send to the pin, and read the state of the pin.

The other option is to define the pin as an output, then when you need it as an input, you can dispose the pin. This was a little fiddly, as needed to modify the source so that the object can be freed, and also add the ability to remove the pin from the pin array that is used to stop it being used twice.
This works quite well.

If you need to be able to tell when the state changes, then you can use a InterruptInput.
You could just use a basic input, and then repeatedly check, but if you need more accuracy then the Interupt is probably better.

I have a device that need to be sent a pulse, then have to read the length of the pulse that comes back.
Swapping between the two pin types works well, but with the interuptInput, if I set it to detect both edges I only see it when it goes high, neve rget the interupt when it has a falling edge.

Strangly if I ask it just to detect falling edges it captures it then.

Taken a day of work tomorrow to work on this and bluetooth, will let you know what solution I find, and post the modifications to the source if it is any use to you.


the first true is if to throw an exception if the socket is not valid. Thought it can not harm setting this to true.

Have just read through the code, the other two parameters do not seem to do much. The first changes the error message you see if the socket is not valid or it can not find the socket in an array of the valid sockets.

The second parameter does not appear to be used.

ok, well to know, I’am new by programming with c# .Before i used arduino :wink:
But i have another question: Can i only use “.ReadProportion” by using “GT.Interfaces”? and what kind of dataTyp do I need to work with?

readProportion is just doing a:

ReadVoltage() / 3.3;

Do you have an example code where you read the analogpin?

I forgot to use the “()” after ReadVoltage >:(
Thanks for your help