Roku BrightSign manual Roku Objects, Examples Gpio Control Port

Page 10

Roku Objects

Take a look at the section of this manual titled “Auto Playing a Video Upon PowerUp”. It shows a simple five line script to autoplay a video, looping. You’ll see it uses the CreateObject() function. This creates a Roku Object. These “objects” provide access to all of BrightSign’s features: playing video, playing images, etc.

There are two other manuals that you’ll need to refer to when writing scripts:

BrightSign HD600 BrightScript Reference -- this describes the actual scripting language

BrightSign HD600 Object Reference -- this describes the Roku Objects, such as “roVideoPlayer”

Examples

A good way to learn BrightScript is to look at or modify existing scripts. You can find links to example scripts at www.rokulabs.com/brightsign.

GPIO Control Port

The BrightSign has a DB25 General Purpose Input Output (GPIO) Port. This port has 12 inputs that can be directly connected to buttons or switches, and 6 outputs that can directly drive LEDs. To use this port you must create a simple but custom cable that connects a DB25 connector to your buttons or LEDs. See the BrightSign Hardware Manual for more information and example circuits. Roku has a test button/LED board that you can purchase to evaluate the GPIO port and test your scripts that read the buttons or set the LEDs.

Here is an example script that will flash an LED for half a second each time a button is pressed on the BrightSign button/led board. Note: line numbers are optional, but are included here to label each line.

100 print "BrightSign Button-LED Test Running"

110 p = CreateObject("roMessagePort")

120 tmr = CreateObject("roMessagePort")

130 gpio = CreateObject("roGpioControlPort")

140 gpio.SetPort(p)

142 sw = CreateObject("roGpioControlPort")

147sw.SetPort(p)

150LED1=2 ^ 17

160LED2=2 ^ 18

170LED3=2 ^ 19

180LED4=2 ^ 20

190LED5=2 ^ 21

200LED6=2 ^ 22

210dim idx(5):idx(0)=LED1:idx(1)=LED2:idx(2)=LED3:idx(4)=LED5:idx(5)=LED6

220msg=wait(0, p)

230if type(msg)<>"roGpioButton" then 220

240butn = msg.GetInt()

250if butn > 5 then 220

255sw.SetOutputState(butn+17,1)

260print "Button Pressed: ";butn

10

Image 10
Contents BrightSign User Guide Table of Contents Examples IntroductionBrightSign Documentation Firmware VersionsExample BrightSign Setups Auto Playing a Slide Show Upon Power-up Auto Playing a Video File Upon Power-upPlaying Media with BrightSign Auto Executing a Script Upon Power-Up ConnectorsMedia Types Supported Device Software and Upgrading BrightSign ShellCreating Interactive Displays Device Types SupportedScripts Hello worldRoku Objects Examples Gpio Control PortLearning More and Support