Authorized Lutron Contributor
Using a keypad as a comdination lock
Attached is a sample project file where the buttons need to be pressed in the order of 1/4/2/3 for the output on the CCO to pulse. If any other combination is used the CCO will not pulse when button 3 is pressed.
To accomplish this programming there is a state variable called "combination lock". This variable has an off state and a state for buttons 1, 2 and 4 but not 3. There is also an automatic sequence for buttons 1, 2 and 4. These sequences set the variable to the corresponding button on preset 1 and have a 5 second dwell time. On step 2 the variable gets set back to the off state. This is so if a button is not pressed after 5 seconds the order in which the buttons need to be pressed will need to be started over.
On the keypad buttons they are conditionals. Preset 1 on buttons 1, 2, and 4 stop the previous sequence and start the sequence for the button that was pressed. Preset 2 stops all sequences and sets the variable back to the off state. On button 3 preset 1 pulses the CCO and sets the variable back to the off state and preset 2 stops all sequences and sets the variable back to the off state. On the press tab of all the buttons there is an If Else statement. If the variable is in the proper state preset 1 is executed else preset 1 is executed. For example on button 4 if the variable is in the "button 1" state then preset 1 is executed else preset 2 is executed.