CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Please advise me about combination door lock

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
chai



Joined: 12 Oct 2009
Posts: 1

View user's profile Send private message

Please advise me about combination door lock
PostPosted: Mon Oct 12, 2009 10:08 pm     Reply with quote

This is some code for combination door lock:
Code:

while ( TRUE )
  {
   while ( TRUE )
     {
      if ( GetKey() != 1 )
         {
          break;
         }
      if ( GetKey() != 2 )
         {
          break;
         }
      if ( GetKey() != 3 )
         {
          break;
         }
      if ( GetKey() != 4 )
         {
          break;
         }
         
       output_high ( LED );
       delay_ms ( 100 );                           
       output_low ( LED );
     }
  }

If press code 1234 on keypad ----> LED on 100 Ms

Please advise me too. How I change this code for:

1. if press code 1234 on keypad ----> LED on 100 Ms or
2. if press code 4567 on keypad ----> LED on 100 Ms or
3. if press code 1357 on keypad ----> LED on 100 Ms or

4. if press code 2468on keypad ----> LED1 on 100 Ms or
5. if press code 9876 on keypad ----> LED1 on 100 Ms or

Thank you for support.
chai
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Oct 13, 2009 12:39 pm     Reply with quote

I think you got that code from this project:
Quote:
COMBINATION LOCK FOR SAFE

http://www.vermontficks.org/safe_combo_d.htm
http://www.vermontficks.org/safe_combo_s.gif

The CCS source code,
http://www.vermontficks.org/safe_combo_c.htm
shows these statements at the top of the program:
Code:

#define     COMBO_1         '1'
#define     COMBO_2         '2'
#define     COMBO_3         '3'
#define     COMBO_4         '4'
#define     COMBO_5         '5'
#define     COMBO_6         '6'

The combination is currently set for: 123456

To change the combination, just enter a different sequence of numbers:
Code:

#define     COMBO_1         '2'
#define     COMBO_2         '5'
#define     COMBO_3         '3'
#define     COMBO_4         '6'
#define     COMBO_5         '1'
#define     COMBO_6         '4'

This changes it to: 253614
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group