Brightsign BrightScript 2 Reference Guide Manuel d'utilisateur Page 20

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 59
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 19
20
Events
Events in BrightScript center around an event loop and the “roMessagePort” Roku object.
Any RokuObject can be posted to a message port. Typically these will be Objects that
are designed to post events. For example, the “roTimer” class posts events of type
“roTimerEvent”.
Example:
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 the following two lines:
while true
msg=wait(0, p)
Could be replaced with:
For each msg in p
And then the last “end while” would become a “next”.
Vue de la page 19
1 2 ... 15 16 17 18 19 20 21 22 23 24 25 ... 58 59

Commentaires sur ces manuels

Pas de commentaire