The first two events are fairly simple but necessary to keep the code repetition to a minimum. First an event to open the door:
Then St, Garage, Ovhd Set 1
->Turn on the lights in the garage
Then Rm, Front Set 1
->Turn on the lights outside the garage
Then Event-Call Set Lt, Garage, Ovhd
Then Event-Call Set Rm, Front
Then Timer, Garage Lock Set 60
->Set a timer that locks the door at 1 second
Then Sw, Door, Garage Lock Set Open ->Unlock the
door
Then Pause Set 50
->Wait for half a second (SECU-16 is very fast)
Then Sw, Door, Garage Open Set Closed ->Open the door
Then we need an event to close the door:
BEGINIF Sens, Door, Garage Is Off
->Only run this if the door is already open
Then St, Garage, Ovhd Set 1
->Turn on the lights in the garage
Then Rm, Front Set 1
->Turn on the lights outside the garage
Then Event-Call Set Lt, Garage, Ovhd
Then Event-Call Set Rm, Front
Then Timer, Gar, Stereo Set 90
->Turn off the garage stereo in 90 seconds
Then Timer, Garage Set 60
->Turn off the garage lights in 60 seconds
Then Timer, Front Set 60
->Turn off the lights outside the garage in 60 seconds
Then Sw, Door, Garage Lock Set Closed ->Lock the garage door
Then Pause Set 50
->Wait for half a second
Then Sw, Door, Garage Open Set Closed ->Close the door
ENDIF
Since the relay that opens and closes the garage door needs to stay open unless we are using it, we have a very small event that will change it back to open any time it is found closed. We also found the relays on the SECU-16 are lightning fast and sometimes the garage door opener isn't capable of detecting a really fast contact closure so we loop a couple of times to waste some time (same thing could be accomplished with the pause commands in the above events). Here is that event:
BEGINIF Sw, Door, Garage Open Is Closed
Do Counter, Garage Open Set 10
->Set loop counter to 10
WHILE Counter, Garage Open Is GT 0
Do Counter, Garage Open Subtract 1
->Subtract 1 from the loop counter
Do Sw, Door, Garage Open Set Closed ->Make sure
that contact is still closed
BEGINIF Counter, Garage Open Is 0
->Check the counter for a 0
Do Sw, Door, Garage Open Set Open ->If
the counter is 0, open the contact
ENDIF
->Close the counter check 'if' statement
ENDWHILE
->Close the 'while' loop
ENDIF
->Close the main 'if' statement