rem this sample script file to be used with HMS boards with 8 or 16 outputs rem this sample script file for 8 input boards only (no TTL data from HMS Board) rem the 'no polling option' has to be set on the HMS board (change in inputs cause the input 'byte' to be sent! delay = 100 'number of milliseconds to wait to check board for ttl input port1 = 0 'outputs 0-7 port2 = 0 'outputs 8-15 p=createobject("roMessagePort") gpio=createobject("roGpioControlPort") ttl=createobject("roSerialPort",1,38400) v=createobject("roVideoPlayer") gpio.SetPort(p) 'set unit to listen for gpio events ttl.SetByteEventPort(p) 'set unit to listen for byte events over 5v serial port v.SetPort(p) 'set unit to listen for video events, including end of video REM REM Array contain names of videos to play dim vlist[9] vlist[0] = "video1.mpg" vlist[1] = "video2.mpg" vlist[2] = "video3.mpg" vlist[3] = "video4.mpg" vlist[4] = "video5.mpg" vlist[5] = "video6.mpg" vlist[6] = "video7.mpg" vlist[7] = "video8.mpg" vlist[8] = "video9.mpg" REM REM Array of light outputs, matching light # with actual binary value dim lights[9] lights[0] = 0 lights[1] = 1 'output 0, or output 8 lights[2] = 2 'output 1, or output 9 lights[3] = 4 'output 2, or output 10 lights[4] = 8 'output 3 or output 11 lights[5] = 16 'output 4 or output 12 lights[6] = 32 'output 5 or output 13 lights[7] = 64 'output 6 or output 14 lights[8] = 128 'output 7 or output 15 start: v.PlayFile("attractloop.mpg") loop: msg = wait(delay,p) rem if both output ports (0-7 and 8-15) on the HMS board need to be set, send both port1 and port2 values rem otherwise just send the port1 value if type(msg) = "roGpioButton" then 'button 0 thru button 7 port1=lights[msg.GetInt()+1] port2=0 'outputs 8-15 off (set this to whatever value you want the outputs 8-15 to be on/off) ttl.SendByte(port1) 'setting output lights 0-7 to match inputs 0-7) ttl.SendByte(port2) 'setting outputs 8-15 (if 16 outputs) v.PlayFile(vlist[msg.GetInt()]) else if type(msg) = "roVideoEvent" then if msg.GetInt() = 8 goto start endif goto loop