Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. General Discussion
  3. single-click, double-click, long-press button possible with MySensors?

single-click, double-click, long-press button possible with MySensors?

Scheduled Pinned Locked Moved General Discussion
5 Posts 4 Posters 51 Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • dirkcD Offline
    dirkcD Offline
    dirkc
    wrote on last edited by
    #1

    Hi all,
    has anyone yet implemented some kind of multi tap button with MySensors?
    Such as single-click, double-click, long-press, ... ?

    I think, I cannot work with interrupts, as I can get a HIGH/LOW once only and cannot count for long-press? Correct? And a battery mode node cannot be used either (with smartSleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR_2),...) because I have to check for e.g. a long-press which might last some seconds ...

    Thanks in advance for any comment or code example?

    Controller: Home Assistant & FHEM - Gateway: ESP8266wifi - MySensors: 2.3.2 (nRF24)

    1 Reply Last reply
    0
    • E Offline
      E Offline
      eiten
      wrote on last edited by
      #2

      hey @dirkc, maybe you can trigger your interrupt to rising and falling edge and use millis() to see how long the press was?

      1 Reply Last reply
      1
      • ZenBlizzardZ Offline
        ZenBlizzardZ Offline
        ZenBlizzard
        wrote on last edited by
        #3

        Yes, it's definitely possible to detect single click, double click, and long press with MySensors. You can use interrupts on both rising and falling edges and track the time with millis() to determine how long the button is held.
        For example:
        Short press = single click
        Two quick presses = double click
        Hold longer than a threshold = long press
        Just make sure to debounce the button to avoid false triggers. If your node is battery-powered and using smartSleep(), handling long presses can be trickier—might be better to stay awake during the press in that case.

        1 Reply Last reply
        0
        • J Offline
          J Offline
          JeeLet
          wrote on last edited by
          #4

          ..
          https://forum.arduino.cc/t/partage-boutons-poussoirs/361656

          https://forum.arduino.cc/t/tutoriel-la-bibliotheque-onebutton/1136825

          1 Reply Last reply
          0
          • dirkcD Offline
            dirkcD Offline
            dirkc
            wrote on last edited by
            #5

            @ZenBlizzard , yes thanks, thats the point. How to deal with smartSleep() and battery lifetime.

            Controller: Home Assistant & FHEM - Gateway: ESP8266wifi - MySensors: 2.3.2 (nRF24)

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            23

            Online

            11.7k

            Users

            11.2k

            Topics

            113.1k

            Posts


            Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • MySensors
            • OpenHardware.io
            • Categories
            • Recent
            • Tags
            • Popular