"Use an Arduino, two potentiometers, and an alarm. Make one of the potentiometers act like a volume control, and make the other potentiometer control the tone that the alarm makes." I added what I have so far. I'm not sure how to control the volume

enter image description here

  • 2
    that is a good start .. the code should be added as text, not as a picture ... the tone() function has no volume control ... perhaps you are supposed to build a volume control circuit
    – jsotola
    Dec 12, 2022 at 23:11
  • @Mahmodol this site is a question and answer site ... its purpose is to answer questions ... if you ask a clear question, then someone will try to answer it
    – jsotola
    Dec 12, 2022 at 23:17
  • 1
    Post a schematic as you have it wired, part of your frizzy picture is not even connected. With such short notice I will be surprised if you get it resolved in time. When you are given an assignment it is best to start ASAP, waiting until the end causes problems like this and missed assignments.
    – Gil
    Dec 13, 2022 at 0:53
  • Welcome to SE/Arduino! Please take the tour to learn how this site works. -- What have you tried to read the values of the potentiometers? -- Please edit your question, don't add a comment. This is not a forum. ;-) Dec 13, 2022 at 10:29

1 Answer 1


Use the other potentiometer as a variable resistor. Instead of connecting to pins 1 and 3 (to control tone), Use the 2nd pin of the potentiometer to make a voltage divider. From the 3rd pin go to a + on a buzzer. I don't see the reason to have the circuit connected the way you have. if you want to control the tone with potentiometer, connect it to stable 5v, and connect the second pin with any analog pins that is configured as input. Then, use map function, and map the voltage, accordingly to the tone you'd like to use.

Not the answer you're looking for? Browse other questions tagged or ask your own question.