rem Autorun_4button.Brs rem use this program to test 4 button box. rem rename this file to Autorun.brs to get the BrightSign to run it rem rename this file Autorun_4button rem there can be no variables set prior to 'Sub Main()' rem GPIO 0-3 are the inputs from the button box rem GPIO 4-7 are the outputs that control the lights Sub Main() 'first create the mesage port p = CreateObject("roMessagePort") tmr = CreateObject("roMeassagePort") 'now create the gpio port gpio = CreateObject("roGpioControlPort") gpio.SetPort(p) 'now set btn0-btn3 as inputs gpio.EnableInput(0) gpio.EnableInput(1) gpio.EnableInput(2) gpio.EnableInput(3) 'now set btn4-btn7 as outputs (low turns on the led's) gpio.EnableOutput(4) gpio.EnableOutput(5) gpio.EnableOutput(6) gpio.EnableOutput(7) 'now set these output states gpio.SetOutputState(4,1) 'gpio_4 is high gpio.SetOutputState(5,1) 'gpio_5 is high gpio.SetOutputState(6,1) 'gpio_6 is high gpio.SetOutputState(7,1) 'gpio_6 is high ? "4 Button Box Testing Program" ? "Start Test Now" start: msg=wait(0,p) 'wait until a message (button is pressed) if type(msg)="roGpioButton" 'get the msg integer specific to this port button=msg.getInt() else goto start 'not gpio endif ? "Button Number=",button if button=0 'btn0 gpio.SetOutputState(4,0) gpio.SetOutputState(5,1) gpio.SetOutputState(6,1) gpio.SetOutputState(7,1) goto start endif if button=1 'btn1 gpio.SetOutputState(4,1) gpio.SetOutputState(5,0) gpio.SetOutputState(6,1) gpio.SetOutputState(7,1) goto start endif if button=2 'btn2 gpio.SetOutputState(4,1) gpio.SetOutputState(5,1) gpio.SetOutputState(6,0) gpio.SetOutputState(7,1) goto start endif if button=3 'btn3 gpio.SetOutputState(4,1) gpio.SetOutputState(5,1) gpio.SetOutputState(6,1) gpio.SetOutputState(7,0) goto start endif goto start End Sub '===================================================================