0

HD1010 and EM100 control of GPIO

Help!!!!

I have created a script file to use with the above named subject. I keep getting the brightsign logo which tells me I have a autorun error.

When I use the debugger I get the following information:

Roku> script
Current Function:
001: stop
Line 0 error code &hf7: STOP
<no source>Backtrace:
Function Main() As Void
entry evsp: 0
Local Variables:
global &h07 rotINTERFACE:ifGlobal
m &h06 bsc:roAssociativeArray, refcnt=2

BrightScript Debugger> autorun

line 2, error code &h02: Syntax Error

When I look at line 2 I see nothing that stands out. I believe it is somewhere else in the script.

I have included the script file for your review.

'****** BrightSign HD1010 Program for ******
'****** CEAVCO Audio Visual 6240 W. 54th Ave. Arvada, CO 80002 ******
'****** 303-539-3400 http://www.ceavco.com 27 April 2011 ******

'****** CREATE MESSAGE PORTS ******
exp = CreateObject("roMessagePort")
p = CreateObject("roMessagePort")
tmr = CreateObject("roMessagePort")
sp = CreateObject("roMessagePort")
gpio = CreateObject("roGpioControlPort", "Brightsign")
gpioEx = CreateObject("roGpioControlPort", "Expander-GPIO")

'****** CREATE GPIO PORT OnBoard******
gpio.SetPort(p)
gpio.EnableInput(0) 'Start movie
gpio.EnableInput(1) 'Stop movie
gpio.EnableInput(2) 'Auto run mode
gpio.EnableInput(3)
gpio.EnableOutPut(4) 'FB for autorun mode info desk
gpio.EnableInput(5)
gpio.EnableInput(6)
gpio.EnableInput(7)

'****** CREATE GPIO PORT EM100******
gpioEX.SetPort(exp)
gpioEx.EnableOutput(0) 'FB for info desk start
gpioEx.EnableOutput(1) 'FB for info desk stop
gpioEx.EnableOutput(2) 'FB for autorun mode rack panel
gpioEx.EnableOutput(3) 'FB for rack panel start
gpioEx.EnableOutout(4) 'FB for rack panel Stop
gpioEx.EnableInput(5)
gpioEx.EnableInput(6)
gpioEx.EnableInput(7)
gpioEx.EnableInput(8)
gpioEx.EnableInput(9)
gpioEx.EnableInput(10)
gpioEx.EnableInput(11)
gpioEx.EnableInput(12)

'****** CREATE TIMER ******
st = CreateObject("roSystemTime")
st.SetTimeZone("MST")
dt = CreateObject("roDateTime")
Timer = CreateObject("roTimer")
Timer.SetPort(p)

'****** CREATE SERIAL PORT ******
serial = CreateObject("roSerialPort",0,115200)
serial.SetLineEventPort(p)
serial.SetEOL(chr(10))

'****** AVAILABLE AUDIO SETTINGS ******
' ANALOG OUTPUT VALUES:
' 0 - Analog audio
' 1 - USB Audio
' 2 - SPDIF audio, stereo PCM
' 3 - SPDIF audio, raw AC3
' 4 - Analog audio with SPDIF mirroring raw AC3

' AUDIO MODE VALUES:
' 0 - AC3 Surround
' 1 - AC3 mixed down to stereo
' 2 - No audio
' (Options 0 & 1 only apply to video files, 2 applies to all audio sources)

' MAPPING VALUES:
' 0 - Stereo audio is mapped to HD810 analog output
' 1 - Stereo audio is mapped to Expander Audio 1 (left) if Expander is present
' 2 - Stereo audio is mapped to Expander Audio 2 (middle) if Expander is present
' 3 - Stereo audio is mapped to Expander Audio 3 (right) if Expander is present

' VOLUME SETTING RANGE:
' 0 = lowest to 100 full volume

'****** VIDEO MPEG FILE SETTINGS ******
video = CreateObject("roVideoPlayer")
video.SetPort(p)
vm = CreateObject("roVideoMode")
vm.SetMode ("1024x768x75p")
video.SetAudioOutput(0)
video.SetAudioMode(1)
video.MapStereoOutput(0) 
video.SetVolume(100)


'****** AUDIO MP3 FILE SETTINGS ******
audio = CreateObject("roAudioPlayer")
audio.SetPort(p)
audio.SetAudioOutput(0)
audio.SetAudioMode(2)
audio.MapStereoOutput(1)
audio.SetVolume(100)

'****** IMAGE SETTINGS ******
image = CreateObject("roImagePlayer")
ok = image.SetDefaultMode(1) 'SET INITIAL IMAGE SCALING
ok = image.DisplayFile("black.bmp")

meta = CreateObject("roAssociativeArray")
meta.AddReplace("CharWidth", 14)
meta.AddReplace("CharHeight", 28)
meta.AddReplace("BackgroundColor", &H000000) ' Dark grey
meta.AddReplace("TextColor", &Hffff00) ' Yellow
tf = CreateObject("roTextField", vm.GetSafeX(), vm.GetSafeY(), 70, 6, meta)

Print "System Started."


firstrun = 1
autoplay = 0

event_loop:
sw3 = gpio.GetWholeState()
sw3 = sw3 and 8 
if sw3 = 8 then 
autoplay = 1
gpioEx.SetOutputState(2,1) 'Sets the autorun FB
goto time_auto_run
endif
msg = wait(1500, p)
if type(msg)="roGpioButton" then buttonpress
if type(msg)="roStreamLineEvent" then seriallinedata
goto event_loop

buttonpress:
butn = msg.GetInt()
If butn = 0 Then 'Start button
ok = video.Stop()
ok = image.StopDisplay()
ok = audio.Stop()

'*********** Put Video Filename in the quotes below *************
ok = video.PlayFile("video.ts")
'****************************************************************
If ok = 0 Then event_loop
msg = wait(100, tmr) 'Delay in ms to sync MP3 file playback with video.
'*********** Put Audio Description Filename in the quotes below *************
ok = audio.PlayFile("audio.mp3")
'****************************************************************************
gpioEx.SetOutputState(4,0) 'Unsets stop button FB info desk
gpioEx.SetOutputState(1,0) 'Unsets stop button FB rack panel
gpioEx.SetOutputState(0,1) 'Sets info desk start button FB
gpioEx.SetOutputState(3,1) 'Sets rack panel start button FB
GoTo manual_wait_for_end
EndIf
if butn = 2 then goto time_auto_run
goto event_loop

manual_wait_for_end:
msg = wait(0, p)
if type(msg) = "roVideoEvent" then
If msg.GetInt() = 8 Then
ok = image.DisplayFile("black.bmp")
gpioEx.SetOutputState(4,1) 'Sets stop button FB info desk
gpioEx.SetOutputState(1,1) 'Sets stop button FB rack panel
gpioEx.SetOutputState(0,0) 'Unsets info desk start button FB
gpioEx.SetOutputState(3,0) 'Unsets rack panel start button FB
GoTo event_loop
EndIf
EndIf
if type(msg)="roGpioButton" then
butn = msg.GetInt()
if butn = 1 then 'Stop button pressed
ok = video.Stop()
ok = image.StopDisplay()
ok = audio.Stop()
ok = image.DisplayFile("black.bmp")
gpioEx.SetOutputState(4,1) 'Sets stop button FB info desk
gpioEx.SetOutputState(1,1) 'Sets stop button FB rack panel
gpioEx.SetOutputState(0,0) 'Unsets info desk start button FB
gpioEx.SetOutputState(3,0) 'Unsets rack panel start button FB
goto event_loop
endif
endif
GoTo manual_wait_for_end

auto_run:
ok = video.Stop()
ok = image.StopDisplay()
ok = audio.Stop()

'*********** Put Video Filename in the quotes below *************
ok = video.PlayFile("Video.ts")
'****************************************************************

If ok = 0 Then event_loop

msg = wait(100, tmr) 'Delay in ms to sync MP3 file playback with video.
'*********** Put Audio Description Filename in the quotes below *************
ok = audio.PlayFile("audio.mp3")
'****************************************************************************
GoTo auto_wait_for_end

auto_wait_for_end:
msg = wait(0, p)
if type(msg) = "roVideoEvent" then
If msg.GetInt() = 8 Then
GoTo auto_program_ended
else
GoTo auto_wait_for_end
EndIf
EndIf
GoTo auto_wait_for_end

time_auto_run:
ct = st.GetLocalDateTime()
ct = mid(ct,15,2)
if ct = "00" then goto auto_run
if ct = "30" then goto auto_run
sw3 = gpio.GetWholeState()
sw3 = sw3 and 8 
if sw3 = 0 then 
autoplay = 0
goto event_loop
else 
autoplay = 1
endif
msg = wait(250, p)
if type(msg)="roStreamLineEvent" then seriallinedata
GoTo time_auto_run

auto_program_ended:
ok = video.Stop()
ok = audio.Stop()
ok = image.DisplayFile("black.bmp")
gpioEx.SetOutputState(2,0) 'Unsets the autorun FB
GoTo event_loop



I have removed the client name in the title section and have generic video and audio files to maintain client information.

Any help will be appreciated

5 comments

  • 0
    Avatar
    Lovell, Willard


    Ok...this is what I am finding

    Current Function:

    006: p = CreateObject("roMessagePort")
    007: tmr = CreateObject("roMessagePort")
    008: sp = CreateObject("roMessagePort")
    009: gpioOnBoard = CreateObject("roGPIOControlPort", "Brightsign-GPIO")
    010: gpioEx = CreateObject("roGPIOControlPort", "Expander-GPIO")
    011: gpioOnBoard.SetPort(p)
    012: gpioEX.SetPort(p)
    013:
    014: '****** CREATE GPIO PORT OnBoard******
    015: gpioOnBoard.EnableInput(0)         'Start movie
    016: gpioOnBoard.EnableInput(1)         'Stop movie
    017: gpioOnBoard.EnableInput(2)         'Auto run mode
    018: gpioOnBoard.EnableInput(3)
    019: gpioOnBoard.EnableOutPut(4)                'FB for autorun mode
    020: gpioOnBoard.EnableInput(5)
    021: gpioOnBoard.EnableInput(6)
    022: gpioOnBoard.EnableInput(7)
    023:
    024: '****** CREATE GPIO PORT EM100******
    025: gpioEx.EnableOutput(0)             'FB for info desk start
    026: gpioEx.EnableOutput(1)             'FB for info desk stop
    027: gpioEx.EnableOutput(2)             'FB for autorun mode
    028: gpioEx.EnableOutput(3)             'FB for rack panel start
    029: gpioEx.EnableOutout(4)             'FB for rack panel Stop
    030: gpioEx.EnableInput(5)
    031: gpioEx.EnableInput(6)
    032: gpioEx.EnableInput(7)
    033: gpioEx.EnableInput(8)
    034: gpioEx.EnableInput(9)
    035: gpioEx.EnableInput(10)
    036: gpioEx.EnableInput(11)
    037: gpioEx.EnableInput(12)
    038:
    039: '****** CREATE TIMER ******
    040: st = CreateObject("roSystemTime")
    041: st.SetTimeZone("MST")
    042: dt = CreateObject("roDateTime")
    043: Timer = CreateObject("roTimer")
    044: Timer.SetPort(p)
    045:
    046: '****** CREATE SERIAL PORT ******
    047: serial = CreateObject("roSerialPort",0,115200)
    048: serial.SetLineEventPort(p)
    049: serial.SetEOL(chr(10))
    050:
    051: '****** AVAILABLE AUDIO SETTINGS ******
    052: ' ANALOG OUTPUT VALUES:
    053: ' 0 - Analog audio
    054: ' 1 - USB Audio
    055: ' 2 - SPDIF audio, stereo PCM
    056: ' 3 - SPDIF audio, raw AC3
    057: ' 4 - Analog audio with SPDIF mirroring raw AC3
    058:
    059: ' AUDIO MODE VALUES:
    060: ' 0 - AC3 Surround
    061: ' 1 - AC3 mixed down to stereo
    062: ' 2 - No audio
    063: ' (Options 0 & 1 only apply to video files, 2 applies to all audio sources)
    064:
    065: ' MAPPING VALUES:
    066: ' 0 - Stereo audio is mapped to HD810 analog output
    067: ' 1 - Stereo audio is mapped to Expander Audio 1 (left) if Expander is pret
    068: ' 2 - Stereo audio is mapped to Expander Audio 2 (middle) if Expander is pt
    069: ' 3 - Stereo audio is mapped to Expander Audio 3 (right) if Expander is prt
    070:
    071: ' VOLUME SETTING RANGE:
    072: ' 0 = lowest to 100 full volume
    073:
    074: '****** VIDEO MPEG FILE SETTINGS ******
    075: video = CreateObject("roVideoPlayer")
    076: video.SetPort(p)
    077: vm = CreateObject("roVideoMode")
    078: vm.SetMode ("1024x768x75p")
    079: video.SetAudioOutput(0)
    080: video.SetAudioMode(1)
    081: video.MapStereoOutput(0)
    082: video.SetVolume(100)
    083:
    084:
    085: '****** AUDIO MP3 FILE SETTINGS ******
    086: audio = CreateObject("roAudioPlayer")
    087: audio.SetPort(p)
    088: audio.SetAudioOutput(0)
    089: audio.SetAudioMode(2)
    090: audio.MapStereoOutput(1)
    091: audio.SetVolume(100)
    092:
    093: '****** IMAGE SETTINGS ******
    094: image = CreateObject("roImagePlayer")
    095: ok = image.SetDefaultMode(1)     'SET INITIAL IMAGE SCALING
    096: ok = image.DisplayFile("black.bmp")
    097:
    098: meta = CreateObject("roAssociativeArray")
    099: meta.AddReplace("CharWidth", 14)
    100: meta.AddReplace("CharHeight", 28)
    101: meta.AddReplace("BackgroundColor", &H000000) ' Dark grey
    102: meta.AddReplace("TextColor", &Hffff00) ' Yellow
    103: tf = CreateObject("roTextField", vm.GetSafeX(), vm.GetSafeY(), 70, 6, meta)
    104:
    105: Print "System Started."
    106:
    107:
    108: firstrun = 1
    109: autoplay = 0
    110:
    111: event_loop:
    112:    sw3 = gpio.GetWholeState()
    113:    sw3 = sw3 and 8
    114:    if sw3 = 8 then
    115:            autoplay = 1
    116:            gpioEx.SetOutputState(2,1)      'Sets the autorun FB
    117:            goto time_auto_run
    118:    endif
    119:    msg = wait(1500, p)
    120:         if type(msg)="roGpioButton" then buttonpress
    121:    goto event_loop
    122:
    123: buttonpress:
    124:    butn = msg.GetInt()
    125:         If butn = 0 Then           'Start button
    126:            ok = video.Stop()
    127:            ok = image.StopDisplay()
    128:            ok = audio.Stop()
    129:
    130:            '*********** Put Video Filename in the quotes below ************
    131:                 ok = video.PlayFile("Kennesaw_Mountain.ts")
    132:            '***************************************************************
    133:                 If ok = 0 Then event_loop
    134:                 msg = wait(100, tmr)               'Delay in ms to sync MP.
    135:            '*********** Put Audio Description Filename in the quotes below*
    136:            ok = audio.PlayFile("Kennesaw Mountain DVI.mp3")
    137:            '***************************************************************
    138:            gpioEx.SetOutputState(4,0)      'Unsets stop button FB info desk
    139:            gpioEx.SetOutputState(1,0)      'Unsets stop button FB rack panl
    140:            gpioEx.SetOutputState(0,1)      'Sets info desk start button FB
    141:            gpioEx.SetOutputState(3,1)      'Sets rack panel start button FB
    142:            GoTo manual_wait_for_end
    143:         EndIf
    144:    if butn = 2 then goto time_auto_run
    145:    goto event_loop
    146:
    147: manual_wait_for_end:
    148:         msg = wait(0, p)
    149:         if type(msg) = "roVideoEvent" then
    150:                 If msg.GetInt() = 8 Then
    151:                         ok = image.DisplayFile("black.bmp")
    152:                    gpioEx.SetOutputState(4,1)      'Sets stop button FB ink
    153:                    gpioEx.SetOutputState(1,1)      'Sets stop button FB ral
    154:                    gpioEx.SetOutputState(0,0)      'Unsets info desk startB
    155:                    gpioEx.SetOutputState(3,0)      'Unsets rack panel starB
    156:                         GoTo event_loop
    157:            EndIf
    158:         EndIf
    159:    if type(msg)="roGpioButton" then
    160:            butn = msg.GetInt()
    161:            if butn = 1 then                'Stop button pressed
    162:                    ok = video.Stop()
    163:                    ok = image.StopDisplay()
    164:                    ok = audio.Stop()
    165:                    ok = image.DisplayFile("black.bmp")
    166:                    gpioEx.SetOutputState(4,1)      'Sets stop button FB ink
    167:                    gpioEx.SetOutputState(1,1)      'Sets stop button FB ral
    168:                    gpioEx.SetOutputState(0,0)      'Unsets info desk startB
    169:                    gpioEx.SetOutputState(3,0)      'Unsets rack panel starB
    170:                    goto event_loop
    171:            endif
    172:    endif
    173:    GoTo manual_wait_for_end
    174:
    175: auto_run:
    176:    ok = video.Stop()
    177:         ok = image.StopDisplay()
    178:         ok = audio.Stop()
    179:
    180:    '*********** Put Video Filename in the quotes below *************
    181:         ok = video.PlayFile("Kennesaw_Mountain.ts")
    182:    '****************************************************************
    183:
    184:         If ok = 0 Then Goto event_loop
    185:
    186:    msg = wait(100, tmr)            'Delay in ms to sync MP3 file playback .
    187:    '*********** Put Audio Description Filename in the quotes below ********
    188:    ok = audio.PlayFile("Kennesaw Mountain DVI.mp3")
    189:    '***********************************************************************
    190:    GoTo auto_wait_for_end
    191:
    192: auto_wait_for_end:
    193:    msg = wait(0, p)
    194:         if type(msg) = "roVideoEvent" then
    195:                 If msg.GetInt() = 8 Then
    196:                         GoTo auto_program_ended
    197:            else
    198:                    GoTo auto_wait_for_end
    199:                 EndIf
    200:         EndIf
    201:    GoTo auto_wait_for_end
    202:
    203: time_auto_run:
    204:    ct = st.GetLocalDateTime()
    205:    ct = mid(ct,15,2)
    206:    if ct = "00" then goto auto_run
    207:    if ct = "30" then goto auto_run
    208:    sw3 = gpio.GetWholeState()
    209:    sw3 = sw3 and 8
    210:    if sw3 = 0 then
    211:            autoplay = 0
    212:            goto event_loop
    213:    else
    214:            autoplay = 1
    215:    endif
    216:         GoTo time_auto_run
    217:
    218: auto_program_ended:
    219:    ok = video.Stop()
    220:         ok = audio.Stop()
    221:    ok = image.DisplayFile("black.bmp")
    222:    gpioEx.SetOutputState(2,0)      'Unsets the autorun FB
    223:    GoTo event_loop
    224:
    Line 9 error code &hf5: BrightScript Component function call does not have the .



    009: gpioOnBoard = CreateObject("roGPIOControlPort", "Brightsign-GPIO")

    Now this is exactly as is shows in one of the examples I have .....can someone tell me what (.) on line 9 in the command it is looking for.

    Thanks

    Will
  • 0
    Avatar
    RokuLyndon


    you're mising your gpio objects..

     = createobject("roControlPort"......)

    The roGpioControlPort is the old object that takes no added variable...
  • 0
    Avatar
    Lovell, Willard


    I thought I tried it both ways.....I will try without the old one again to make sure I did not miss that.

    Thanks for your response

    Will
  • 0
    Avatar
    RokuLyndon


    Also, the gpio event you're looking for is incorrect as well.

    with the new object, you are looking for type "roControlDown" or "roControlUp", but not rogpiobutton.
  • 0
    Avatar
    Lovell, Willard


    Thanks

    Downloaded the new object manual and all others I needed.

    Have a great day

    Will
Please sign in to leave a comment.