JChristensen / JC_Button

Arduino library to debounce button switches, detect presses, releases, and long presses
GNU General Public License v3.0
425 stars 102 forks source link

Simulate physical button press? #19

Closed trawlerguy closed 5 years ago

trawlerguy commented 5 years ago

Hello Mr. Christensen, I have three physical buttons, but have a need to simulate a button press in my sketch. I guess I'm looking for something like myBtn.press();. Other than getting out a soldering iron and attaching a wire from an available GPIO to the switch itself to pull it low, not sure what else to do, how to get past this. Any ideas? Thanks in advance!

JChristensen commented 5 years ago

This doesn't sound like an issue with the library but rather just a logic problem with the sketch. I'd just have the sketch test for whatever condition that requires the simulated press, then execute the necessary code. If by "simulate" you mean actually driving the pin low without pressing the switch, then the soldering iron approach or something similar would be required. Unless I'm not understanding something.