Cov txheej txheem:

Safe Box: 3 Kauj Ruam
Safe Box: 3 Kauj Ruam

Video: Safe Box: 3 Kauj Ruam

Video: Safe Box: 3 Kauj Ruam
Video: Rae Sremmurd - No Type (Official Video) 2024, Hlis ntuj nqeg
Anonim
Safe Box
Safe Box
Safe Box
Safe Box
Safe Box
Safe Box

Nov yog qhov koj qhov txiaj ntsig kawg yuav tsum yog tom qab muab tso ua ke thiab tso cov cai.

Kauj Ruam 1: Yam Koj Yuav Tsum Tau

Yam Koj Yuav Tsum Muaj
Yam Koj Yuav Tsum Muaj
Yam Koj Yuav Tsum Muaj
Yam Koj Yuav Tsum Muaj
Yam Koj Yuav Tsum Muaj
Yam Koj Yuav Tsum Muaj
Yam Koj Yuav Tsum Muaj
Yam Koj Yuav Tsum Muaj

Jumper Wires, 220 OHM resistor, 16x2 LCD Screen, Push Button, Servo Motor, Breadboard, Arduino Uno.

Kauj ruam 2: Code

James chinchay

#suav nrog

#ncig #ncig

int chaw nyob = 0; zoo li qub tsis tau kos npe ntev SaveTimer; zoo li tsis tau kos npe ntev SaveDelay = (30 * 1000);

char CODE [10] = "1234E"; char Str [10]; char CodeLength = 4; int Pos = 0; bool Xauv; zoo li tsis tau kos npe ntev DisplayTimer; zoo li tsis tau kos npe ntev DisplayDelay = 200;

LiquidCrystal lcd (12, 11, 9, 8, 7, 6);

int buttonPin1 = 2; int buttonPin2 = 3; int buttonPin3 = 4; int buttonPin4 = 5;

int nkag mus = 10; int clearlockbutton = 13;

Servo myServo; // teeb tsa qhov kev tsim kho qhov program tsis ua haujlwm teeb tsa () {

myServo.attach (A1);

int EEPROMCodeOK = muaj tseeb; rau (Pos = 0; Pos <= (CodeLength); Pos ++) {Str [Pos] = EEPROM.read (Pos); yog (! (strrchr ("1123456789", Str [Pos]))) {// tsis yog tus lej siv tau EEPROMCodeOK = cuav; }} Pos ++; Str [Pos] = EEPROM.read (Pos); yog (Str [CodeLength + 1]! = 'E') EEPROMCodeOK = tsis tseeb; yog (EEPROMCodeOK) {Str [CodeLength + 2] = '\ 0'; strncpy (CODE, Str, CodeLength + 1); } ClearCode (); // teeb tsa inputs pinMode (buttonPin1, INPUT_PULLUP); pinMode (buttonPin2, INPUT_PULLUP); pinMode (buttonPin3, INPUT_PULLUP); pinMode (buttonPin4, INPUT_PULLUP);

pinMode (enterbutton, INPUT_PULLUP); pinMode (clearlockbutton, INPUT_PULLUP);

lcd.begin (16, 2); lcd.setCursor (0, 0); // teeb tsa lcd.print messaged ("Nyob Zoo Mr Birch"); ncua (2000); lcd.clear (); lcd.setCursor (0, 0); // teeb tsa sai rau lo lus zais lcd.print ("Password:");

DisplayTimer = millis () + 200; }

void voj () {

Xauv ();

Pos = txwv (Pos, 0, CodeLength); // nyeem cov nyees khawm int buttonState1 = digitalRead (buttonPin1); int buttonState2 = digitalRead (buttonPin2); int buttonState3 = digitalRead (buttonPin3); int buttonState4 = digitalRead (buttonPin4);

int clButtonState = digitalRead (clearlockbutton); int enterButtonState = digitalRead (enterbutton);

lcd.setCursor (9, 0); // yuav tsum tau qhib yog tias (buttonState1 == LOW) {Str [Pos] = '1'; Pos ++; Str [Pos] = '\ 0'; ncua (250); thaum (digitalRead (buttonPin1) == LOW);

}

lwm tus yog (buttonState2 == LOW) {Str [Pos] = '2'; Pos ++; Str [Pos] = '\ 0'; ncua (250); thaum (digitalRead (buttonPin2) == QAU);

}

lwm tus yog (buttonState3 == LOW) {Str [Pos] = '3'; Pos ++; Str [Pos] = '\ 0'; ncua (250); thaum (digitalRead (buttonPin3) == QAU); }

lwm tus yog (buttonState4 == LOW) {Str [Pos] = '4'; Pos ++; Str [Pos] = '\ 0'; ncua (250); thaum (digitalRead (buttonPin4) == QAU);

} lwm yog (enterButtonState == LOW) {Str [Pos] = 'E'; Pos ++; Str [Pos] = '\ 0'; ncua (250); thaum (digitalRead (buttonPin1) == LOW); yog (strcmp (Str, CODE) == 0) {Xauv = muaj tseeb; lcd.setCursor (0, 0); lcd.print ("Tau Txais Kev Pab"); ncua (2000); lcd.clear (); lcd.print ("Xauv"); } lwm yog (SaveTimer> millis () && (Pos + 1) == CodeLength) {

strcpy (CODE, Str); rau (Pos = 0; Pos <= (CodeLength+1); Pos ++) {EEPROM.write (Pos, Str [Pos]); } lcd.setCursor (0, 0); lcd.print ("Txuag Nyiaj Code:"); lcd.setCursor (0, 1); lcd.print (Str);

Xauv = muaj tseeb; }

lwm tus {

lcd.clear (); lcd.print ("Nkag Tsis Tau."); ncua (2000); lcd.clear (); lcd.print ("Lo lus zais:");

} // unlocking code thaum (Xauv) {Unlock (); yog (digitalRead (clearlockbutton) == LOW) {ncua (200); lcd.clear (); lcd.print ("Xauv"); ncua (2000); lcd.clear (); Xauv = tsis tseeb; SaveTimer = millis () + 30000; }}

ClearCode ();

}

lwm tus yog (clButtonState == LOW) {ncua (500);

thaum (clearlockbutton == LOW); yog ((millis () - SaveTimer)> 4500) {

}

ClearCode ();

}

yog ((ntev) (millis () - DisplayTimer)> = 0) {DisplayTimer += DisplayDelay; lcd.setCursor (9, 0); lcd.print (Str); lcd.print ("");

} }

tsis muaj dab tsi ClearCode () {

Pos = 0; Str [Pos] = '\ 0'; lcd.setCursor (0, 0); lcd.print ("Lo lus zais:"); lcd.setCursor (0, 1); lcd.print ("");

}

void Unlock () {

myServo.write (150);

} // program locking button void Lock () {

myServo.write (50);

}

Kauj ruam 3:

thaum ua txhua yam nws yuav tsum zoo li no.

Pom zoo: