Connect piezo with input and output at the same time

Hello, im building a Sonar with a Piezo element. I need to connect the piezo to an input and output pin at the same time, to generate soundwaves and read them at the same time. But I don’t know how to do this. Is it possible to connect the piezo directly on one pin to the output and on the other side to the input? Or do I have to connect ground to something? I could connect one pin to ground and the other to a single analog pin, but I want to listen to the sound all time. And that is not possible, because if it is switched to output it can’t listen.

You connect one side to ground and the other side to 2 pins. One of those pins is defined as an output which you use to generate the signal and the other pins is an input which you use to read the signal. Just like the ping library.

Thank you very much for answering this question. :slight_smile:

blh64:
You connect one side to ground and the other side to 2 pins. One of those pins is defined as an output which you use to generate the signal and the other pins is an input which you use to read the signal. Just like the ping library.

Err, no!

electronicsnoob:
I need to connect the piezo to an input and output pin at the same time, to generate soundwaves and read them at the same time.

And no, you don't want to do that.

Care to explain what it is you are attempting to do?

@electronicsnoob

Other post/duplicate DELETED
Please do NOT cross post / duplicate as it wastes peoples time and efforts to have more than one post for a single topic.

Please READ THIS POST to help you get the best out of the forum.

Bob.