I hope someone can help. There is an error in the following script but I can't seem to find it. It loads, but as soon as I press a button on the GPIO I get the dreaded 10 flashes of the error light.
Thanks in advanced.
--Paul
Sub Main()
p = CreateObject("roMessagePort")
gpio = CreateObject("roGpioControlPort")
gpio.SetPort(p)
bcp = CreateObject("roControlPort", "BrightSign")
bcp.SetPort(p)
gpio.EnableInput(0)
gpio.EnableInput(1)
gpio.EnableInput(2)
gpio.EnableInput(3)
gpio.EnableOutput(4)
gpio.EnableOutput(5)
gpio.EnableOutput(6)
gpio.EnableOutput(7)
v = CreateObject("roAudioPlayer")
REM v.SetLoopMode(false)
REM v.SetVolume(100)
v.SetPort(p)
Main_Loop:
msg = wait(0,p) if type(msg) = "roroGpioBUtton"
if msg.GetInt() = 0 then
A = 1
LEDA = 1
else
A = 0
LEDA = 0
end if
if msg.GetInt() = 1 then
B = 2
LEDB = 1
else
B = 0
LEDB = 0
end if
if msg.GetInt() = 2 then
C = 4
LEDC = 1
else
C = 0
LEDC = 0
end if
if msg.GetInt() = 3 then
D = 8
LEDD = 1
else
D = 0
LEDD = 0
end if
end if
song = A + B + C + D
gpio.SetOutputState(0,LEDA)
gpio.SetOutputState(1,LEDB)
gpio.SetOutputState(2,LEDC)
gpio.SetOutputState(3,LEDD)
if song <> 0 then
ok = v.PlayFile("\" + song + ".mp3")
msg = wait(0,p)
if type(msg) = "roAudioEvent" and msg.GetInt() = 8
ok = v.StopClear()
gpio.SetOutputState(0,0)
gpio.SetOutputState(1,0)
gpio.SetOutputState(2,0)
gpio.SetOutputState(3,0)
end if
end if
goto Main_loop
End Sub
autorun.brs