2 buttons in Arduino Uno

Hi.
I have a ready-made project with one button.
How do I make a project with two buttons?
The description doesn't cover this very well.

Let's see your one button code, then maybe someone here will give you some suggestions

In the IDE click on Edit, then Copy for forum. That will copy your code for pasting on this forum.
Then come back here and just do a simple paste.

If you want to make your life simple, I'd suggest you use one of the numerous button library such as Button in easyRun or OneButton or Toggle or EasyButton or Bounce2, ...

If you want to learn, you can also study the code in those libraries.

Hi.
Thanks for your reply. I'm a beginner programmer.
Your program is very complex for me.
I have a simple program with one button. How can I make two buttons at the entrance?

  • pushbutton attached to pin 2 from +5V
    • 10K resistor attached to pin 2 from ground

// constants won't change. They're used here to set pin numbers:
const int buttonPin = 2; // the number of the pushbutton pin

/ variables will change:
int buttonState = 0; // variable for reading the pushbutton status

void setup() {
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
}

void loop() {
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);

// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (buttonState == HIGH) {
,,,,,

Your posting of the code did not come out right
Did you do Copy for forum?

  • When you read the posting guidelines for this web site, you are expected to draw a schematic of your current wiring and a schematic of how you want it changed.

  • Schematics are how we communicate our project wiring to others.

  • Please supply us with the wiring schematics you come up with.

  • For the sketch, supply us with an all inclusive preamble describing everything that is supposed to happen with program dependencies.

Have you looked at any tutorial ? Blinking leds and handling buttons is usually where they all start.

Study https://docs.arduino.cc/learn/

You can just simply clone everything, the circuit and all lines on code.

and so on....