' The below code makes relay 1 follow the status of digital input 5 ' If you have any questions, email: support@DataNab.com ' For more code examples, go to the support & downloads section of www.datanab.com prev = 0 i = 1 j = 1 10 In5V = iostate(205) ' check state of dig input 5 if In5V <> prev then ' if input changes state temp$ = sprintf$("%u",In5V) ' convert state of input into a string syslog temp$ ' send string representing state of input out on syslog prev = In5V ' set previous equal to current so we can catch the next state change endif if In5V = 1 then ' if on if i = 1 then ' only do it once IOCTL 1,1 ' turn relay 1 on i = 0 j = 1 endif else ' otherwise if j = 1 then ' only do it once IOCTL 1,0 ' turn relay 1 off j = 0 i = 1 endif endif goto 10 ' repeat from 10 END