I just noticed this thread, or I would have jumped in sooner.
I've been working on a project with the lofty goal of making microcontroller-driven relay bypass easy as possible for the DIY pedal builder.
See here:
mcu-relay-controller on GitHub. I'm not using the Arduino suite, I'm doing more generic C, trying to create an abstraction to easily support multiple microcontrollers. (Currently working on ATtiny85, ATtiny13a, pic12f675, pic10f320.)
I just received my first PCBs last week, and this weekend was finally able to move from the breadboard to an actual PCB. On the breadboard, instead of using an actual momentary switch, I simulated the switch by manually touching a jumper wire to GND. This appears to not have bounce (or at least not like a momentary switch). So my initial too-simple debounce scheme didn't work reliably. I spent a lot of the time reading about debouncing. My current GitHub code has something that seems to work pretty well, though I have another version that's a bit simpler, but not pushed into the GitHub repo yet.
My impression is that most people who want their MCU to react button presses aren't putting the MCU to sleep. If you don't put the chip to sleep, then you can use a timer interrupt to basically periodically poll the switch pin. I look at it as a quasi-"threaded" approach to debouncing.
I ended up doing essentially the same as what you guys are doing here in this thread: read the switch pin, sleep a bit, read it again. The argument against this method is that having those sleeps in the main execution loop means CPU time is being wasted. But, in my case at least, I don't really care, as monitoring the switch and (re)setting the relay is literally all the MCU is doing.
One other thing I'll note: the schematic posted in the first post appears to drive the relays directly from the MCU pins. It seems that this is one of those things that "everyone does", but may not be best practice. In particular, the relay coil is essentially an inductor, and once current to it stops, the coil's field will collapse generating a huge voltage spike. In practice, it appears that the GPIO pins of AVR and PIC MCUs are robust enough to handle that, but, that has to be weighed against
this discussion.
My current bypass PCB indeed drives the relay directly from the MCU pins. But I just ordered "v2.0" PCBs that use a double-coil latching relay (Kemet EC2-3TNU); the coils are transistor driven (the MCU just turns the transistors on/off), and the transistors are protected with flyback diodes. (It seems a lot more components are needed to do this with the single-coil latching relay.)