my circuit what is supposed to be

Can someone pls help me only the two buttons clossest to the big green wire work and i don^t know why i have already tried swapping buttons

EDIT 1: my code this is my code

and i know the first two are working because they generate a tone with the piezo the third one does nothing and the last one only makes static noises

  • Why bother, I don't like multiple buttons with resistors for an analog value. I think your circuit is okay. It could be a bad contact of the breadboard.
    – Jot
    Apr 14 '19 at 8:07
  • How can you tell, that they don't work? Please explain more. And please show us your code. You can edit your question to add these information by clicking at the edit button under your question. Please format the code correctly, by selecting it and clicking the {} button
    – chrisl
    Apr 14 '19 at 8:08
  • @Jot This is a starter kit project. It teaches how you can multiplex multiple buttons into a single analog input and figure out which button(s) are being pressed from a single line. It might not be something you want/need to do, but it's still a worthwhile concept to learn.
    – Duncan C
    Apr 14 '19 at 12:16
  • 1
    please do not post a picture of the code .... post the code text .... use the {} button to format it
    – jsotola
    Apr 14 '19 at 17:01
  • 1
    your code contains a serial.print() command .... please open the serial monitor in the arduino IDE and find out what values are being printed for each button press .... add those values to your question above
    – jsotola
    Apr 14 '19 at 17:05

I see the problem. The connections to the first 2 buttons are correct. You're missing a yellow wire linking the output of the bottom 2 buttons to AO however, so the 3rd and 4th buttons are not connected to your A0 pin at all. Add a yellow wire between row 24 and row 20 on your breadboard.


I see now that there is a green wire connecting rows 24 and 20 together. However, that is the likely place where things go wrong. I would suggest taking a couple of jumpers and connecting them to a multimeter set to continuity mode. Put one in row 28, and then test continuity to row 24, row 20, and row 16.

One of your wires may not be seated into the breadboard properly, or you may even have a bad row on your breadboard. I've seen that before.

EDIT #2:

A multimeter is your friend. If you don't have one, you should get one, and learn how to use it. It's invaluable for troubleshooting circuits. (Get one that has a continuity mode that beeps when it detects continuity, and that has auto-ranging voltage and resistance measurements.)

  • thank you this really helped me think what if it is the breadboard so i took of the sticky backside and there were some loose pieces of metal i pushed on these pieces and now it works Apr 16 '19 at 12:08
  • only problem i have now is that the analog read value from the when i press the last button isn't a steady 1023 but even if i connect the analog directly to the 5v line it isn't steady so i think that should be solved in code but i am not sure Apr 16 '19 at 12:17
  • Yes, I would suggest not matching a specific value. Write your code to check for a range of analog values. Your circuit is a voltage divider, and the button with no resistor (the bottom one in your illustration) will give a value close to, but not quite, 5V. I'd suggest looking for a value ≥1020 for that button. Check the value you get for the other buttons and implement ranges with upper/lower bounds for those.
    – Duncan C
    Apr 16 '19 at 15:08
  • thanks alot for the reply the value >= 1020 made it work perfectly for me. Again thanks for your help Apr 16 '19 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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