Dear GHI Community,
I want to do something “simple”. I have a sensor that outputs a PWM signal and I want to read it with my FEZ Spider, I am using .NETMF 4.2. There are a few posts saying the best way to read a PWM signal is to use PinCapture. First of all, there is no PinCapture in 4.2 but it is called SignalCapture, am I right?
I am a little bit confused how to use the SignalCapture class. In the PinCapture tutorial the code is as follows:
static PinCapture cap = new PinCapture((Cpu.Pin)FEZ_Pin.Digital.Di2, Port.ResistorMode.Disabled);
Using .NETMF 4.2 and my FEZ Spider I can create a digital output on a pin by setting the socket and then the corresponding pin as you can see here:
GTI.DigitalOutput pin3Socket11 = new GTI.DigitalOutput(GT.Socket.GetSocket(11, true, null, null), GT.Socket.Pin.Three, false, null); // Motor 1 DIRECTION
So, I say that I want to use socket 11 and then pin 3 from this same socket. It is very straightforward and easy to understand!
How do I use the SignalCapture class? The class wants the code to look like this, so that there are no errors:
SignalCapture DIScapture = new SignalCapture(Cpu.Pin.GPIO_Pin11, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeBoth);
But what is this Cpu.Pin.GPIO_Pin11? To which socket does this pin belong? I just used Pin11, there were many other pins available. Can you help me figure out how to set up pin capturing on any pin on FEZ Spider?
Then, how do I figure out the correct duty cycle?
Thank you in advance!