0

BrightScript Beginner - Compile Error

Hello,

I've used Brightauthor for nearly 4 years now, and I wanted to try out using BrightScript.

I basically want to create a presentation that more or less goes like this: when a GPIO is triggered, audio plays. When audio plays, a seperate GPIO pin is driven high. When the audio ends, or when a third GPIO is triggered again, the audio ends immediately and resets.

This would take me 10 minutes in BrightAuthor, but I'm trying to do this in a way that will allow my client to simply drop the mp3 file they want on the card when they want to change it, rather than deal with BrightAuthor themselves. (I've walked clients through it and written guides before, but I'm seeking an easier alternative for the future.)

Anyhow, I've been trying to work with the "Select and Audio file, blink led during Playback" example from here: https://brightsign.zendesk.com/hc/en-us/community/posts/209950357-Script-Examples-incl-Simple-Showcontrol-Script

It uses the old roGpioControlPort object, so I've been trying to update it to the roControlPort object. I can never get my program to run on the Brightsign, as I keep getting the 10-blink error code for autorun error. I've gotten to the point where I've basically stripped out everything but getting a button and an LED to turn on, and it still isn't working. Any help would be appreciated. Code is below:

 

p = CreateObject("roMessagePort")
gpio = CreateObject("roControlPort", "Brightsign")
gpio.SetPort(p)

gpio.EnableInput(0)
gpio.EnableInput(1)
gpio.EnableOutput(4)
gpio.EnableOutput(5)

gpio.SetOutputState(4, false)
gpio.SetOutputState(5, false)

listen:
msg = wait(0,p)
if type(msg) = "roControlDown" then
if msg.GetInt() = 0 then
gpio.SetOutputState(4, true)


else if msg.GetInt() = 1 then
gpio.SetOutputState(5, true)
endif


if type(msg) = "roControlUp" then
if msg.GetInt() = 0 then
gpio.SetOutputState(4, false)


else if msg.GetInt() = 1 then
gpio.SetOutputState(5, false)
endif
goto listen

 

 

2 comments

  • 1
    Avatar
    Bright Scripters

    Seems like you are missing endif in two places.

    Here is one place

     

    if type(msg) = "roControlUp" then

       if msg.GetInt() = 0 then
       gpio.SetOutputState(4, false)


       else if msg.GetInt() = 1 then
       gpio.SetOutputState(5, false)
       endif


    endif ' <--- missing

     

    It would help you in such process, to become familiar with the command line debugger. You can access to the debugger via serial port, or via ssh.

  • 1
    Avatar
    Lmccallister

    Ah, right you are on that. That fixed it right away.

    I'm used to writing C++, this is my first scripting language, so I was sure I was missing something much bigger, not a simply missing and endif statement. 

Please sign in to leave a comment.