Player APIs (BrightScript & Ja...
...
BrightScript
Language Reference

Events

1min
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 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 print "brightsign button led test running" p = createobject("romessageport") gpio = createobject("rogpiocontrolport") gpio setport(p) while true msg=wait(0, p) if type(msg)="rogpiobutton" then butn = msg getint() if butn <=5 then gpio setoutputstate(butn+17,1) print "button pressed ";butn sleep(500) gpio setoutputstate(butn+17,0) end if end if rem ignore buttons pressed while flashing led above while p getmessage()<>invalid end while end while note that lines 6 7 can be replaced using the following (and substituting end while with end for ) for each msg in p