Home AMX User Forum AMX Technical Discussion

Emulate button press for 3 seconds?

Hi there,

I need to emulate a button press for 3 seconds within Netlinx. DO_PUSH doesn't take a duration option for the button press itself and if the button is not pressed and holded for 3 seconds it has a different function... Anybody has an idea? I have player with SET_PULSE_TIME and PULSE but without luck!

thanks much

Comments

  • viningvining Posts: 4,368
    You could create another button with the function you want to execute just for use with this Do_Push.
  • bobbob Posts: 296
    I also thought about creating a second button, but how do I send a push that is 3 seconds long when this second button is pressed once (single press)?
  • viningvining Posts: 4,368
    I thought your current button has one function when pressed and a 2nd function when held for 3 seconds? If you create another button (just in code not on the TP) with just the second function you can use the Do_Push for that and leave the button with two function for use on the TP only. When ever code you need to initiate the 2nd function in code Do_Push the new button.

    A Do_Push doesn't actually push a button on the TP but initiates a button_event for that device and channel number in the code.
  • bobbob Posts: 296
    vining wrote: »
    I thought your current button has one function when pressed and a 2nd function when held for 3 seconds?
    Absolutely, but this is interpreted at the controlled device. In Netlinx it is still one button which sends the same IR code. Depending on pulse duration (single press or 3s-press), the conrolled device does two different things. I am looking how to emulate the 3s-press with a single button press for instance from a 2nd button on the TP (which I also want to DO_PUSH in the code).

    Thanks again!
  • SensivaSensiva Posts: 211
    DO_PUSH_TIMED

    Though I am not sure why you want to do this (providing more info may help us give you a best fit solution), But how about Do_Push_Timed ??
    DO_PUSH_TIMED
    Similar to DO_PUSHexcept this one lets you specify the timeout. DO_PUSH defaults to a 0.5s push on a channel before issuing a DO_RELEASE for you (unless another DO_PUSH is executed for the same channel). DO_PUSH_TIMED lets you control the length of time that will pass before the automatic DO_RELEASE is generated. The syntax:

    DO_PUSH_TIMED(DEV Device, INTEGER Channel, LONG Timeout)

    Parameters:

    Device - the device to PUSH.

    Channel - the channel to PUSH.

    Timeout - the time (in 1/10ths of seconds) that the PUSH shall remain active. If zero is specified as the timeout then the timeout is 0.5s. If DO_PUSH_TIMED_INFINITE is specified as the timeout then the push never times out.

    Returns: None

    Example:

    DO_PUSH_TIMED (dvTouchPanel, 5, 10) // push button 5 for 1.0S
  • bobbob Posts: 296
    Wow, didn't knew about the DO_PUSH_TIMED function! Thanks much!
Sign In or Register to comment.