I'm running into the same issue now (I need to generate a pulse on a port to trigger the measurement, and then want to use interrupts on it) with the same sensor. Basically, as I see it, there are two choices: use two ports (one outputport and an iterruptport, left in the image) or use an external circuit to generate the triggering pulse and an interruptport (right). (sensor works like this: you send a pulse over the signal line, and then after a delay it sends a pulse back, and the length of the pulse translates to the distance).
However, as I'm an electronics newbie, I'd like to clear up some issues first:
I weakly recall that somewhere here in the forum someone said never to connect one output and one input port, because that can/will lead to frying the pin. I don't quite get this, because the input port should be high impedance, so currents between them should be low, right?
However, this also means that the output port can sink current when the sensor sends its pulse back. this i can imagine as a problem, both because that might disrupt the measurement on the input port and because there's no current-limiting factor there. I'm reluctant to add a diode there, because the voltage drop of e.g. a 1n4148 combined with the netduinos 3.3v output levels could mean that the neccessary pulse height isn't reached to trigger the measurement. Should I simply add a resistor there? What would be a good value for that?
A similar problem exists for the external circuit, a bit less because the circuit has higher output levels and so there is no problem with adding a diode, i think ...
Can someone clear my doubts for me? Thanks!
I believe that no discovery of fact, however trivial, can be wholly useless to the race, and that no trumpeting of falsehood, however virtuous in intent, can be anything but vicious.
-- H.L. Mencken, "What I Believe"