Honestly, I just thought I would use 25 kHz because I need ultrasound to penetrate wood. Do you know someone who's done something like this before? I mean, I really need help. and what I'm trying to do is a hand-held device and so the first thing that I'm trying to do is make arduino act as a function generator.

Honestly, I just thought I would use 25 kHz because I need ultrasound to penetrate wood

So why pick a 40kHz transducer?

These things are not like loudspeakers with a roughly flat response across part of the audio spectrum - they peak massively at their resonant frequency; that's what they're designed for.

Generating 40kHz is relatively simple (a simple for loop with some padding will need a little tuning and experimentation), it just depends what else you need to be doing at the same time, but you seem to be avoiding the question.

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.Do not send technical questions via personal messaging - they will be ignored.

why are you saying that i'm avoiding your question? i mean what question anyway?what i am doing may be too simple for you so I just need to know how to generate sine wave using arduino? that's all. thank you

Are you saying that the Arduino (which doesn't need to generate a sine wave; you can prove this by switching your sig-gen to square) just needs to generate 40kHz?You could do that with a 555 and save yourself money.Do you need continuous 40kHz (in which case you won't be able to use full power), or do you want bursts of maximum power at a PRR of 10Hz?

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.Do not send technical questions via personal messaging - they will be ignored.