top of page

Button Task

This program displays a button on the Show page and displays the number of times it has been pressed in real time. It runs a task called b_press each time the button is pressed.

Program


---

Button Task Program

---


prog_vars =

d/count 0

prog_vars.


prog_start =

pclear

print "Button Task Program Start"

-- Set button to run b_press task when pressed.

pb c c ^p=b_press^n=Run Task^

b_press

prog_start.


prog_loop =

-- main program loop

patdog


prog_loop.



b_press =

inc /count

ptl c d "Button Presses /count"

b_press.


prog_stop =

print "Bye"

prog_stop.


bottom of page