Jump to content
C4 Forums | Control4

Keypad Color-code Password


Recommended Posts

Looking for a way to put a Pre-password lock on a Video Source. The passcode can be based on the 4-button color codes. Looking for any recommendations.

The programming in my mind looks like this. Just don't know how to start and don't understand how the variable should look for the passcode.

When Xbox 360 is selected in RoomA

Wait for Passcode to be entered

If Password entered is correct

emit IR code

If Password entered is incorrect

Play Announcement "Incorrect Password"

Exit to Default Selection

Link to comment
Share on other sites


Let's say your password is button 1, 2, 3, 4 (or the colored buttons, but the numbers make the idea easy to illustrate)

You need a short timer, non repeating, let's call it password.

You need a boolean variable, let's call it pw.

When button 1 is pressed

if password timer is not running

if pw = 0

start password timer

set pw = 1

When button 2 is pressed

if password timer is running

if pw = 1

set pw = 2

when button 3 is pressed

if password timer is running

if pw = 2

set pw = 3

when button 4 is pressed

if password timer is running

if pw = 3

set pw = 4

when password timer expires

if pw = 4

emit IR code

set pw=0

stop

play announcement 'incorrect password'

Link to comment
Share on other sites

Let's say your password is button 1, 2, 3, 4 (or the colored buttons, but the numbers make the idea easy to illustrate)

You need a short timer, non repeating, let's call it password.

You need a boolean variable, let's call it pw.

When button 1 is pressed

if password timer is not running

if pw = 0

start password timer

set pw = 1

When button 2 is pressed

if password timer is running

if pw = 1

set pw = 2

when button 3 is pressed

if password timer is running

if pw = 2

set pw = 3

when button 4 is pressed

if password timer is running

if pw = 3

set pw = 4

when password timer expires

if pw = 4

emit IR code

set pw=0

stop

play announcement 'incorrect password'

I could be wrong - but I think that you will need to SET PW=0 on each step - otherwise you will increment each time you hit a correct key and there is no penalty for hitting wrong keys - very close though...

Or am I missing something?

Bill

Link to comment
Share on other sites

Well, it will only increment if the timer is running, and if the variable is on the correct state, and the timer only starts if you hit the correct button first. So yes, you're correct, to be truly foolproof, you could add a stop and then reset to zero outside the conditional.

Thinking through the logic, you would need to at least change the timer expires script a bit to reset the variable in every case.

when password timer expires

if pw = 4

emit IR code

set pw = 0

stop

set pw = 0

play announcement 'incorrect password'

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...