I am using a PKM34EW piezo speaker with a ToneAC library to generate a frequency between 19Khz - 22kHz.
If I were to just send a single tone, I will not hear any tickling sound. However, if I were to alternate the frequency between 19kHz - 22kHz with a '0' in between, I am gonna hear the tickling (Not quite sure what do you call that) sound.
Here is my sketch:
#include <toneAC.h>
void setup() {
}
void loop() {
toneAC(19000);
delay(1000);
toneAC(0); //if I remove this, I won't hear the tickling sound. But if you put your ear very near to the speaker, you can hear it
delay(1000);
toneAC(20000);
delay(1000);
}
Is there a way that I completely remove the tickling sound if I were to call toneAC(0)?
Did you connect the piezo between two pins ? or with only one output pin and GND ?
What happens when you use "noToneAC();" instead of "toneAC(0);" ?
What happens when you use "toneAC(100000);" for a silence ?
Are you use that you are hearing the click of "toneAC(0);" or the change from 20kHz to 19kHz. Since it runs in the loop, the 20kHz is followed by the 19kHz.
I was not able to remove the clicks completely myself. The toneAC() is a lot better than the default tone() library, but it is hard to output silence or ultrasonic without hearing something. On the other hand, I can only hear it with from a short distance.