const int pingPin = 9;
void setup()
{ tone(9, 40000); }
void loop() { }
If you use a digital output the Peak to Peak voltage is 5 volts (or very close to it).
I don't know how you would detect the 40 kHz signal without a oscilloscope. If you had a second Arduino and a second transducer you could try playing a 41000 Hz tone and listen for the 1 kHz beat frequency.