' {$STAMP BS2} ' {$PBASIC 2.5} PinNumber VAR Byte PinState VAR Byte LOW 3 Main: ' Use the programming port to receive ' data at 2400 baud ' Wait for the synch byte (255) and then ' get the PinNumber and PinState 'SERIN 16,17405,[WAIT(255),PinNumber,PinState] this command is for BS40P only SERIN 16,16780,[WAIT(255),PinNumber,PinState] 'SERIN 0,84,[WAIT(255),PinNumber,PinState] 'SEROUT 1,84,[PinNumber,PinState] ' If PinState=0 Then go to GoLow ' otherwise go to GoHigh BRANCH PinState,[GoLow,GoHigh] GOTO Main ' Set The pin low GoLow: LOW PinNumber GOTO Main ' Set the pin high GoHigh: HIGH PinNumber GOTO Main