...
Enables an alternate function on a GPIO button. This This method applies to the onboard GPIO connector and is currently supported on the XTx44, XTx43, XDx34, XDx33, HDx23, and HO523 models.
...
Code Block |
---|
c = CreateObject("roControlPort", "BrightSign") 'Enable serial port 1 on the GPIO. c.EnableAlternateFunction(0, "serial1") c.EnableAlternateFunction(6, "serial1") s1 = CreateObject("roSerialPort", 1, 115200) s1.SendLine("This is serial port 1") mp = CreateObject("roMessagePort") s1.SetLineEventPort(mp) ? wait(10000, mp) 'Switch serial port 0 from the 3.5mm serial port to the GPIO. '[Note: it is advised use telnet/ssh or a script when testing this] c.EnableAlternateFunction(4, "serial0") c.EnableAlternateFunction(5, "serial0") s = CreateObject("roSerialPort", 0, 115200) s.SendLine("Hello on the console?") mp = CreateObject("roMessagePort") s.SetLineEventPort(mp) ? wait(10000, mp) 'Restore normal operation on serial port 0. c.EnableAlternateFunction(4, "gpio") c.EnableAlternateFunction(5, "gpio") 'Enable IR input on the GPIO. c = CreateObject("roControlPort", "brightsign") ? c.EnableAlternateFunction(1, "irin1") nexus_encodings = [ "NEC", "NEC32" ] ir_gpio = CreateObject("roIRReceiver", { source: "GPIO", encodings: nexus_encodings }) mp = CreateObject("roMessagePort") ir_gpio.SetPort(mp) m = wait(10000, mp) 'Enable IR output on the GPIO (HDx23, HO523 only--the XTx43XT/XDx33XD models have a dedicated 3.5mm IR socket) c.EnableAlternateFunction(2, "irout") ir = CreateObject("roIRTransmitter", { destination: "GPIO"} ) ir.Send("NEC32", &H12345) |
...