I’m working on a project in which space is at a premium (I’m trying to fit the final design inside a USB-stick type case) and would like to use the same button to control selection with short presses (to cycle through the different modes) and perform a hard reset if held for 3-5 seconds. My 1st though was to use some sort of resistor-capacitor circuit to hold the reset pin high until the cap had discharged, but I’m having trouble getting the details sorted into a workable design.
Has anyone else done something like this?
Thanks, and I may look into that if I can't figure something out, but I should have specified that I'd like to avoid a reset unless the button is held down for some period of time. I'll be using a bluetooth connection, and would like to avoid the overhead that comes with reestablishing the connection.
Your idea of putting a low pass filter on the reset line seems like the best bet. You could connect an input pin upstream of the filter to detect the short button presses.
So I gave this a shot, and without the reset line wired to the Arduino it worked as expected… short presses dropped the “upstream” side of the circuit to ground, and the downstream side fell to ground over about 6 seconds. When I wired the downstream side to the Arduino reset pin, the voltage there never fell below 4.4V. Here’s the circuit, let me know what you think-