tone (4,1000,250);
Before the button is pressed for the first time, the speaker is completely silent.
After the button is pressed for the first time, the tone command runs, but then the problem happens.
From then on, there is a constant low level background noise emanating from the speaker. Looking at it with a scope, it is a 200mV pulse at about an 8 cps rate.
The output of GPIO4 is feeding a high impedance amplifier. I tried putting a big capacitor across the VCC and GND pins, made no difference.
My question is what could cause the GPIO port to become unstable once it is used, but not before?
I suspect the 'tone' commmand is leaving the port somehow 'on'.
Any ideas?