rem gpio.brs 'outputs messages to the screen as gpio inputs are activated Sub Main() mp=CreateObject("roMessagePort") 'CREATE THE MESSAGE PORT '===================================================================== 'create the gpio port object GPIO=CreateObject("roGpioControlPort") 'enable the gpio port GPIO.SetPort(mp) 'connect messages to the gpio port '===================================================================== 'now create the text field object for the screen meta = CreateObject("roAssociativeArray") meta.AddReplace("CharWidth",20) meta.AddReplace("charHeight",28) meta.AddReplace("BackgroundColor", &H202020) 'dark grey background meta.AddReplace("TextColor", &Hffff00) 'yellor (red+green) vm = CreateObject("roVideoMode") tf = CreateObject("roTextField",vm.GetSafeX(), vm.GetSafeY(),40,20,meta) ? #tf, "waiting for 'gpio button event'" while true msg = wait(0,mp) ? #tf, "type(msg) = "; type(msg) if type(msg)="roGpioButton" then ? #tf, "button number = ";msg.getint() serial.sendbyte(lights_array[msg.getint()]) endif endwhile End Sub 'main