Maximite 2: How to make switch trigger only once when pressed


Author Message
Decoy
Senior Member

Joined: 02/08/2019
Location: Denmark
Posts: 109
Posted: 11:30am 30 Nov 2020      

Hi guys

I finally had some time with the Maximite 2, after building a couple of them several months ago. I am recovering from my double-incision distal bicep tendon repair, so everything is done with the left hand

I've managed to hook up a switch, with a cap to prevence bouncing (Arduino-style). How would I go about making the switch only register once per press, to avoid holding in the switch being seen as constant presses. I think I used the millis() function in Arduino ages ago - buw to do this on Maximite 2? Maybe a pre-made function exists?

Something like:

variable = 0
if button is pressed then variable = variable +1

I need the variable to count only once per press, then the switch must be depressed before pressing (and adding to variable) again.

Any advice?
Thanks!