Need help with arduino schema - 4 buttons to interrupt and to solo pins

Hi i am working on school project and i need to use Arduino uno and connect 4 buttons to arduino interrupt pin (2,3) and to their own digital pins. But my connection didnt work and i dont know how to do it.

Before you asked, i can not use different type of arduino to have for every button their own interrupt pin. I need to connect them all to 1 pin and every button solo pin.

Later i need to do some method to filter which button or combination of buttons were pressed. But it will be second problem.

This is my connection (only in painting) i hope u will understand it. This is half working when every button can use interrupt pin, but i dont know how to connect them correctly to digital pin.

I will appreciate every help.

Hello
What do you expect now?

You need to give the professor's exact wording for the problem.

In theory, there is only need to use 1 (one) interrupt, either int0 or int1... are you suppose to use both?

What i know i should use 1 interrupt pin. Every button should be called by interrupt but they need to call different method. If you know what i mean.

Hello
Is this a school asignment or do you have practical application to do this?

Yes, basically i need to do machine which will be showing time, date, temperature, humidity etc, but i need to use interruptions for 4 buttons.

Hello
You don´t need an hardware interrupt. You can scan the current state of the buttons inside the loop() by using a button manager.

OK.
Here is the logic, but you must write the code for yourself. Thanks for being honest and advising this is a school project, in this regard the forum is just an extension of your research.

Think of one button connected to D4 and another to D5. The other side of the buttons are connected to GND.
D4 and D5 are configured as digital inputs and the internal pull-up is active, thus a small current will flow through the switch when closed and the pin will go from high (open) to low (ground) on switch closure.

The problem is asking how to use an interrupt to detect switch closure rather than polling the D4 and D5 lines. In we assume D2 is the interrupt pin we wish to use, how can we detect that either D4 or D5 has been pressed? Remember D4 and D5 are at a 5V potential due to the internal bias resistor (pull-up) that we turn on in the setup() part of our code.

Think about using a resistor(s) from the top of each switch (connection to D4, D5 ...) all to the interrupt pin. The value chosen must cause the voltage on the int0 or int1 pins to drop from logic high to logic low when any switch is closed.

You will need to draw the schematic, do some math on the voltage drop at the interrupt pin, select the correct resistor values, write the code for interrupt and the code to rapidly inspect D4, D5, D6, D7 to determine which was pressed ... write as functions to fulfill the "methods" requirement.

He needs an interrupt IF the assignment states that as a requirement. Why I wanted the exact wording of the exercise.

This reference on digital pins should help with the resistors calculation:

https://www.arduino.cc/en/Tutorial/Foundations/DigitalPins

There are 20K pullup resistors built into the Atmega chip that can be accessed from software. These built-in pullup resistors are accessed by setting the pinMode() as INPUT_PULLUP. This effectively inverts the behavior of the INPUT mode, where HIGH means the sensor is off, and LOW means the sensor is on.
...
The value of this pullup depends on the microcontroller used. On most AVR-based boards, the value is guaranteed to be between 20kΩ and 50kΩ. On the Arduino Due, it is between 50kΩ and 150kΩ. For the exact value, consult the datasheet of the microcontroller on your board.

I would prefer to use diodes to connect the 4 digital inputs to the interrupt input.
@bujak Did you already learn somthing about diodes ?

For NC switches, the 2-button w/diodes would look like

$ 1 0.000005 10.20027730826997 50 5 50 5e-11
g 112 384 112 432 0 0
R 96 48 96 16 0 0 40 5 0 0 0.5
w 96 48 160 48 0
w 160 48 208 48 0
w 208 48 224 48 0
w 112 384 144 384 0
w 144 384 176 384 0
w 176 384 224 384 0
w 144 384 144 320 0
s 144 320 144 256 0 0 false
w 224 384 224 320 0
w 144 256 144 192 0
w 144 192 160 192 0
r 160 48 160 192 0 20000
w 160 192 368 192 0
r 224 256 224 48 0 20000
w 224 256 368 256 0
s 224 320 224 256 0 0 false
w 416 192 512 192 0
w 512 192 512 288 0
w 448 256 448 288 0
w 368 192 416 192 0
w 368 256 448 256 0
p 448 256 464 256 1 0 0
p 512 192 528 192 1 0 0
d 448 288 448 384 2 default
d 512 288 512 384 2 default
w 448 384 512 384 0
p 512 384 560 384 1 0 0
w 224 384 304 384 0
w 448 384 416 384 0
w 416 384 384 384 0
r 304 384 384 384 0 470000
x 576 387 614 390 4 24 int0
x 474 260 504 263 4 24 D4
x 549 191 579 194 4 24 D5
b 112 80 325 174 0
x 290 102 323 105 4 24 PU
x 103 299 132 302 4 24 S1
x 238 300 267 303 4 24 S2

https://falstad.com/circuit/

Logic - voltage reference:
https://learn.sparkfun.com/tutorials/logic-levels/all#33-v-cmos-logic-levels

Conversion to NO switches and extended to 4 digital inputs and all coding left to student.

Ray

I'd prefer a pullup on int0 too. Than you don't have a voltage divider. Maybe @bujak can do this change.

Does this help:
image