I just started to learn the basic concepts of electrical circuits and want to build my own custom switching Bit, using a proto Bit and a magnetic contact switch (door sensor).
So I imagined a good place to start is to look at the circuit of the default i3 button Bit:
In this circuit I can see that - besides the switch itself - there is a resistor and a capacitor.
I know a capacitor can store energy, and it's probably there to "debounce" the button element (so a single push on the button doesn't result in multiple on/off signals).
But: how exactly does this work? And: why is the resistor there?
Any technical insights would be appreciated!