Pins and things

Hello all,
I am linking to a device that has one pin that needed to by knocked high then low for the device to take a reading, then I need to record the length of the pulse that comes back.

I have it linked to an extender fine.
I can send it the pulse by using a ‘DigitalOutput’, and the little light on the fellow lets me know it is working.
I now need to turn it to a ‘GT.Interfaces.InterruptInput’, but can find no way of releasing the pin to allow me to bind to it again.

I have tried to dispose on the Digital output var, tried on the extender, but can find no way to remove it that way, or to force it into the garbage collector.

Is there a trick to getting the pin to be released, or do I need to go to a CPU.PIN?


Not as of now. But the good thing is you have full source code available for gadgeteer core so you can easily change it.

Not sure I understand but would tristateport help?

Perfect, downloaded the code and added a this.port.dispose on a new procedure.

Thought I may be able to use a tristate, but was not sure how to capture when the pulse started and ended.

The one line modification above should be fine, will test it in a moment.

Thank you.

Are you, by any chance, working with something like the Seeed ultrasonic ranging sensor? Or, perhaps, the DHT11 temperature/humidity sensor?

For the DHT11, at least, the problem was solved by using two pins instead of one: one TriState port, and one used for PinCapture.

The other option, of course is RLP.

Playing with a couple of Parallax inc sonar devices.
I am an complete electronics novice. Only recently learnt what a breadboard was.

They were the cheepest I could find at around £25.

Only one pin for input and output.Thought this would be handy, so that I can put a few devices on a single extender.

It should all work fine now, I can dispose the pin, and changed the code that when I free the pin, it removes the pin from the reserved list.

Spent a little time working out which files were needed when you change the source, and that you need to copy them into the origional install directories even if you remove the resource, and point to the newly compiled dll.

Long day of coding at work today, so could not face it tonight. Tomorrow will fight with the UAC, or security so can compile directly into the install directories for NetMF and the GHI code on Windows 7.
Also looks like I may need to recompile all of the units in one go, as there was a complaint when I just recompiled and copied over the NETMF side.

When I get this sorted, will post what I did, to help out any other newbies.