Go Down

Topic: Project 07 Keyboard Instrument (Read 31891 times) previous topic - next topic


Now to work out why the circuit doesn't work properly... tomorrow night
Photography nut trying to make the flux capacitor of macro pho


I tend to agree. Most of the projects I've done had some sort of mistakes in them. It added to the challenge, don't get me wrong. However this project wasn't as fun simply due to vaguely working breadboard. It took me 4 attempts to get all four buttons to work. I made a mistake with one, but the other two that weren't working simply needed a different spot on the board. I had to move last button over to the other side of the board in order to get it to work. Not ideal. Discouraging at times.


There is no mistake in this code. The first 2 lines:

int buttons[6];
int buttons[0] = 2;

are EXAMPLE lines, to show how it works. You can identify them because they have no number. The code always starts at

anything before that is 'code' to explain things.


Hello, I am a newcomer to arduino and I too have been having a problem with this project. The first key (notes[0]) is the only one not working and this is after I made the change to the code suggested by mikeucfl.

Code: [Select]
void setup() {
  buttons[0] = 2;

Furthermore when I tried changing the ranges for the first two keys to see if I could get a wider range for the first key to play (1000-1023 for first key and 990-1000 for second), the second key instead played the note the first key was supposed to play and the first key was still silent (I got this idea from the fact that since the last key was near the highest value and had a small range of values to read the actual note would have a slight stutter when played, so I tried tweaking the range values). My breadboard is the same as the one in the manual. Does anyone have any suggestions for me? Thanks.


Had same problems w/ '0' being returned; turned out I had (at least) 2 bad buttons in my kit. IMHO, they should have put a little less emphasis on making the book look pretty (got to love the 10 point font for readability too!), and more(?) on better components at this price...

Either way, still enjoying it immensely :)


Just wanted to report that I had similar issues on this project. The first issue I've had really since starting with the book.

It was kind of weird though and after getting it to work I can't really explain what was wrong.

Looking at the diagram in the book it was the top push button that was not activating the piezo and reading zero in the serial monitor. Removing the push button and replacing with a normal wire instead made the circuit work as intended, giving me 1023 in the serial monitor, so the breadboard seemed fine.

I then got my multimeter and set it to resistance and measured across the push button noticing it change to zero resistance when I depressed the button. This seemed to suggest the button was working.

Then, not sure what was going on, I read this forum and decided to move the button one row down on the breadboard. It worked. I then swapped the button over for one of the other ones and they both worked.

So not sure what the problem is to be honest. Anyway, thanks for the tip, hope it doesn't catch me out again.


My problem with the buttons not working is that the pins don't reach all the way down into the breadboard.

I was able to fix by bending a set of pins outward and inserting the other deeper into the breadboard. After that it worked.


I think that may be a typo in the book (I see it in mine as well). AWOL's suggestion would fix it, or you could move 'int buttons[0] = 2' into the setup method and drop the int declaration.

Code: [Select]

void setup() {
  buttons[0] = 2;



Those two lines aren't actually for the code. They are only an explanation of how arrays are written.
The actual code starts at "int notes []= ..."

You can see that on the right side line 1 only starts there


The buttons part is NOT part of the code.  It was just an example.


my last 2 buttons don't do anything. help?

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131