Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • Did... you... just misspell else as esle!? Commented Feb 19, 2017 at 3:03
  • 3
    This has been asked many times, both here and on the Arduino Forum. For one treatment (by me) see this. Commented Feb 19, 2017 at 4:03
  • Thanks for the link. Ill have a look and will try my best. Ha:) Commented Feb 19, 2017 at 4:20
  • Also posted on Arduino Forum Commented Feb 19, 2017 at 6:59
  • you need a state machine with two states (unpressed, pressing). You also save a timestamp each time the state changes. You can compare the last change's timestamp with the system time to determine if it's time to move to the next state. "unpressed" changes to "pressing" upon a button press (if state is unpressed). "pressing" changes to "unpressed" if it's been 1000ms since the last change AND the button is not pressed. Commented Feb 19, 2017 at 8:46