This example demonstrates how to fire multiple actions based on how long a button is pressed. The example uses a PV780 with physical buttons however the same technique applies to touch screen buttons as well.
- When a button is pressed a loop counter starts incrementing that represents quarter second intervals.
- An Activity program is called to determine how long the button has been depressed and take action based on time.
- When the "Act while button Held" button is pressed the Activity Program is called every 250mSec and fires all the actions while the button is held.
- When the "Act after Button Release" button is pressed, the Activity Program is only called after the button is released and fires just one action based on the loop counter value.
Which method you choose depends on your application. The activity program can be coded to perform any number of functions as needed for your application.
This example was created in version 2.9.23044 for a PV780.