Tuesday, November 16, 2021

Touch Portal - Traffic Light - Cycling through different pictograms when pressing a button

TouchPortal is a low-cost alternative to the Stream Deck.

Here's a little example on how to cycle through different pictos when pressing a button.


Method 1

1. Go to 'Main Menu / Values'

2. Add value with id 'nine_traffic' and name 'nine_traffic' and default value 0, this will be our counter


3. Save


4. Create a new button on a page, we'll attach a little program to this button which will increase the counter on every press, and then change the looks of the button depending on that value



5. You can test this button by refreshing your tablet, then go on the host to the page 'Main Menu / Values'

6. Now every time you press that button, the value of nine_traffic will increase, from 0 to 1, then 2, then back to 0


7. Go back to the button and the script at 'On Pressed', now we change the picto depending on the value of nine_traffic using this: (click to enlarge)


Done.


Method 2

This splits up the action in two parts, one when the button is pressed, one depending on changes of the value.

1. Create a value as above

2. Create a button, use the following script for the On Press and On Event tabs:



Done.


No comments:

Post a Comment