You can just connect a capacitor from I/O pin D6 to GND and connect the switch in parallel with it.
simulate this circuit – Schematic created using CircuitLab
The Arduino Nano uses the ATmega328P which has Schmitt trigger inputs for all its GPIO pins. This ensures that the relatively slow rise voltage on the capacitor will not cause input 'chatter' as it passes through the uncertainty voltage range found in logic signals.
When the switch is pressed, it will short-circuit the capacitor, drawing an instantaneously-large discharge current through itself. This arrangement of switch and debounce capacitor is very common and has been used in millions of products and equipment around us for decades. Few or none of these switches or capacitors have been damaged by this.
You need to know the switch bounce period. You should take this from the datasheet. If you do not have this, most switches are 3..10 ms so you can use a working guess value of 10..20 ms. But look the value up if at all possible.
To calculate C, you need the following values:
- Switch debounce period (or use 15 ms) tdb
- Schmitt input trigger voltage (min.) Vtmin
- Pull-up resistor value (min.) Rpumin
- Supply rail voltage (min.) Vddmin
Note that the minimums are used. The maximum for any of these values will make the RC charging or detection time longer, which means the circuit will debounce its input for longer. If it debounced for a shorter time when the RC tolerances changed, the switch might still be bouncing and those might get detected, so this goes in the safe direction.
Some of these can be found in the ATmega328P datasheet:
- Vt = approx. 2.6 V (from Pin Threshold graph)
- Rpu = 30..60 kohm, so Rpumin = 30000 ohms
For the Arduino Nano supply rail, I'll assume (a terrible word) a 5 V +/- 0.25 V regulator. So Vddmin = 4.75 V.
Transposing the capacitor charging equation
$$v=V(1-e^\frac{-t}{RC})$$
for C gives
$$C=\frac{-t}{R*ln(1-\frac{v}{V})}$$
So $$C=\frac{-0.15}{30000*ln(1-\frac{2.6}{4.75})}=630 nF$$
Use 680 nF.