Brightsign BrightScript 3.0 Reference Manual Manual de usuario Pagina 30

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 75
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 29
25
EVENTS
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.
Example: 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
Vista de pagina 29
1 2 ... 25 26 27 28 29 30 31 32 33 34 35 ... 74 75

Comentarios a estos manuales

Sin comentarios