I am following this guide to produce tones with the arduino: https://www.arduino.cc/en/Tutorial/BuiltInExamples/toneMelody
This uses the tone()
builtin function. The connections is that one pin of the speaker got to one digital pin of the arduino, while the other goes to ground.
Is there a way to perform volume control (perhaps with a potentiometer) on this setup? What worries me is that this is digital information (PWM) that goes to the speaker, and not an analog signal that can be adjusted.