Double click and long press button



  • Hi

    I'm new at Unipi and Mervis.
    I have some experience with Loxone.

    What I'm looking for is the following:
    I have 5 locations in my project with 4 push-buttons.
    These buttons should have multiple functions.
    I'd like to use single push and double push, but also long press.

    I do not find a function block for any of these. Is this possible?
    This is the basis of any home automation. So I think it would be strange if this doesn't exist.

    Thanks a lot
    Robin


  • administrators

    Hi @ecobouwadvies,
    the Mervis is capable of handling this, but not out of the box. There are many basic function blocks, but they typically perform very simple tasks. The Mervis is a tool to express logic, but it doesn't specializes to some kind of logic, such as home automation, industrial automation, agriculture and so on. The expression of the logic is on the programmer.

    To process the double click you need to start measuring a time interval and if in predefined limit the second click will not appear, it will be evaluated as a single click. If it exceeds a predefined time limit and the digital input will be still true, it will be evaluated as a long press.

    Please, bear in mind that the PLC is a software PLC and thus it is not running in detereministic time loops. There are techniques how to make the Mervis program running faster, such as proper setting of the Autogen. All in all, take a look at our tutorials to get an idea what it entails to program in Mervis.

    Good luck with your projects,
    Martin