How do I add 2 buttons with example sketch?

More seriously, this has caused a most confusing issue, likely to do with the function prototypes the IDE creates for you:

void buzz(int 2)

I tried auto-format and it didn't say/do anything.

Frank-duino:
I tried auto-format and it didn't say/do anything.

When I do it I am warned "Auto Format Cancelled: Too many right curly braces"

I have tried to verify your code and it seems to be a complete mess with names used twice and names used that are not declared.

But the first big problem is void buzz(int 2)

I have no idea what you think that does but there should be a variable name where you have the "2". However (consistent with the other mess-ups) you don't actually use the value in the function.

Then the next big problem is

  void buzzer() {
  digitalWrite(10, HIGH);
}

which is trying to define a function within the setup() function.

Again I have no idea what you want void buzzer() to do so I can't advise whether to delete it or to move it outside setup().

I could go on ... but you will learn more if you do it yourself.

...R

Robin2:
...
...
Then the next big problem is

  void buzzer() {

digitalWrite(10, HIGH);
}



which is trying to define a function within the setup() function.

Again I have no idea what you want void buzzer() to do so I can't advise whether to delete it or to move it outside setup().

I could go on ... but you will learn more if you do it yourself.

...R

i guess i'm guilty for that one;
http://forum.arduino.cc/index.php?topic=222865.msg1617120#msg1617120

Ok, I ran the auto-format again and I just saw the exact same warning. What does it mean....

I just saw the exact same warning. What does it mean....

If it's the same one as quoted above, it probably means there's more than an ample sufficiency of these '}'

Yeah, I deleted one of the curly brackets from the bottom and I don't have the error anymore.

What should I do now?

Frank-duino:
What should I do now?

what do you want to do now ?
before you dive into code that you're obviously still not comfortable with, try a really simple "sketch" - NOT Arduino code, just plain English.

write out in words what you want to do;

eg.

  • setup the pins (ie. define what is connected where, which are inputs, outputs, etc)
  • start reading your inputs (check if button is pressed, if yes - do what, if not - do what other thing)
  • actuate your outputs (do the various things you want done - ie. execute the commands/functions)

in the code that you have, or we hope, rewrite - add comments to say/explain(to yourself & others) what it does, or at least what you think it is doing.
and then post it here and we can guide you better if there's any misunderstanding.

retronet_RIMBA1ZO:
NOT Arduino code, just plain English.

Excellent advice.

...R