The code for this schematic was given to you in post #17.
The software code that outputs to the serial monitor needs to be changed/updated to accommodate the LCD, this is easily done.
The capacitors are there for two reasons.
- they filter any possible noise from damaging an input, especially when long cabling is used.
- they act as a de-bounce feature for each switch.
You might be able to omit these capacitors in your project, however, suggest you leave them in circuit.
The sketch offered in post #17 scans the switches one at a time to see if it is closed.
If the switch is closed, a counter is incremented.
After scanning all the switches, the value of the counter is printed to the serial monitor or LCD.
Note: when a switch is open that associated input sits at zero volts (LOW) because of the 1k resistor going to ground.
When that switch is closed, 5v from the Arduino goes to the top of this resistor and a HIGH is thus presented to the input.
When the sketch sees this HIGH on the input pin, a 1 is added to the software counter.
Please realize the ‘heavy/wide BLUE’ line is not a wire; this blue line is called a bus.
The black lines entering this bus go to the destination that ‘their’ signal name signifies (called a ‘net name’).
For example, the switch circuit (S1) at the far left of the schematic is attached to the Arduino header pin 17.
This switch signal has the net name “D02”, so does the black line coming out of the Arduino pin 17.
Two or more black lines with the same net name are connected together.
Black lines that come together at a ‘black dot’ are to be connected together.
If there is ‘no black dot’ where wires cross, there is no connection between these lines.
Test time.
The switch circuit at the far right side of the schematic (S15) has the net name “D16”.
What pin on the Arduino are you supposed the connect the S15 circuit to?