rem gpio2video.brs Sub Main() Development = False 'Development = True If Development ? "This is gpio2video.brs" Endif '*********************************************************************** 'creating the message port mp=CreateObject("roMessagePort") '*********************************************************************** 'creating the gpio control port Gpio=CreateObject("roGpioControlPort") Gpio.SetPort(mp) 'attach GPIO messages to the message object '*********************************************************************** 'NOW CREATING THE RECTANGLE TO HOLD THE CANVAS WIDGETS RECT1 = CreateObject("roRectangle",0,0,1920,1080) cw1 = CreateObject("roCanvasWidget",rect1) aa1 = CreateObject("roAssociativeArray") aa1["text"] = "HMS Electronics 'GPIO Event' Script" aa2 = CreateObject("roAssociativeArray") aa2["text"] = "Waiting on GPIO Event" aa3 = CreateObject("roAssociativeArray") aa3["text"] = "Waiting on GPIO Event" aa1["targetRect"] = { x: 300, y:180, w:1000, h:200 } aa1["textAttrs"] = { Color:"#ffffff", font:"Huge", HAlign:"Center" , vAlign: "Top" } '******************************************************************************* 'Dick:can't seem to set the color of the rectangle of the canvas widget rem aa1["backgroundColor"] = { Color: "#808080"} rem aa1.AddReplace("backgroundColor", &h10ff10) this does nothing '******************************************************************************* aa2["targetRect"] = { x: 300, y:380, w:1000, h:200 } aa2["textAttrs"] = { Color:"#ffffff", font:"Large", HAlign:"Center" , vAlign: "Top" } aa3["targetRect"] = { x: 300, y:580, w:1000, h:200 } aa3["textAttrs"] = { Color:"#ffffff", font:"Large", HAlign:"Center" , vAlign: "Top" } 'now show the rectangle?? ok = cw1.Show() if Development ? "just did show ";ok sleep(10000) endif cw1.Setlayer(aa1, 1) cw1.Setlayer(aa2, 2) cw1.Setlayer(aa3, 3) cw1.EnableAutoRedraw(1) if development ? "should have a multiple canvas widgets on the screen with text" endif '********************************************************** if development ? "Waiting for a GPIO Event" endif 'this is a forever loop while true 'wait for a message msg = wait(0,mp) if development ? "Got a message" ? "type message =";type(msg) endif cw1.EnableAutoRedraw(0) aa2["text"]="Message Type = "+type(msg) cw1.SetLayer(aa2,2) aa3["text"] = "Button Number = "+str(msg.getInt()) cw1.SetLayer(aa3,3) cw1.EnableAutoRedraw(1) endwhile End Sub