Events in BrightScript center around an event loop and the roMessagePort object. Most BrightScript objects can post to a message port in the form of an event object: For example, the roTimer object posts events of the type roTimerEvent roTimerEvent when configured intervals are reached.
The following script sets the destination message port using the SetPort()
method, waits for an event in the form of an roGpioButton object, and then processes the event.
...
Note that these two lines 6-7 can be replaced using the following (and substituting end while
with end for
):
Code Block |
---|
For each msg in p |