SHARE
TWEET

Untitled

a guest Aug 19th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void loop()
  2.    if button_is_pressed
  3.       if !press_in_progress
  4.          press_in_progress = true
  5.          start = millis()
  6.    else
  7.       if press_in_progress //Button has been released
  8.          elapsed = millis() - start
  9.          press_in_progress = false
  10.          if elapsed > long_press_threshold
  11.             long_press_function()
  12.          else
  13.             short_press_function()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top