Hi everyone!

You don't need the two digital writer's for the input pins - INPUT_PULLUP implys that.

The last post fom PaulS shows a method of detecting edges, change of state to de-bounce you need to check several time and act when multiple checks are the same or check once and then wait a bit before checking again.

What you want to achieve is to ignore very short pulses and respond to a steady state or a 'confirmed' change of state.