Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wire.h> //Reikalingas ekranui
- #include <LiquidCrystal_I2C.h> // Reikalingas ekranui
- #include <Keypad.h> // reikalingas klaveturai
- const byte ROWS = 4; //four rows
- const byte COLS = 4; //four columns
- //define the cymbols on the buttons of the keypads
- char hexaKeys[ROWS][COLS] = {
- {'1', '2', '3', 'A'},
- {'4', '5', '6', 'B'},
- {'7', '8', '9', 'C'},
- {'*', '0', '#', 'D'}
- };
- byte rowPins[ROWS] = {9, 8, 7, 6}; //connect to the row pinouts of the keypad
- byte colPins[COLS] = {5, 4, 3, 2}; //connect to the column pinouts of the keyp
- Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
- int slaptSimbol = 0;
- int slaptazodis[4];
- int slaptazodisDAUG[4] = {1035, 58, 12, 158};
- int slapt = 0;
- char customKey = customKeypad.getKey();
- int sk = customKey - '0';
- //#define BACKLIGHT_PIN 13
- LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address
- void setup()
- {
- Serial.begin(9600);
- lcd.begin(16, 2);
- lcd.clear();
- Serial.write("Uzkrovem setup");
- prisijungti(4, 5555);
- }
- void loop()
- {
- }
- bool prisijungti(int SLAPTAZODZIOilg, int SLAPTAZODIS) { // Bandyk ta informacija per cia ideti
- // SLAPTAZODIS tai tas tavo galutinis, sudaugintas numeris (6315)
- // SLAPTAZODZIO_KUODOTE[] tai tie skaiciai kuriuos daugins (1035, 58, 12, 158)
- lcd.setCursor(2, 0);
- lcd.print("PRISIJUNGIMAS");
- int bandomasSlapt = 0;
- Serial.write("Pradejom krauti funkcija");
- for (int i = 0 ; i < SLAPTAZODZIOilg ; i++ ) {
- while (customKey) {
- slaptazodis[slaptSimbol] = sk;
- Serial.write("Paspaudem skaiciu");
- }
- // Cia isivedi ta skaiciu i masyva ir sudaugini ar dar kokia nesamone sugalvoji
- bandomasSlapt += slaptazodis[slaptSimbol] * slaptazodisDAUG[slaptSimbol] + slapt;
- lcd.setCursor(6 + slaptSimbol, 1);
- lcd.write("*");
- }
- if(bandomasSlapt == SLAPTAZODIS)
- {
- lcd.setCursor(11, 1);
- lcd.print("OK");
- Serial.write("Slaptazodis Geras");
- return true;
- }
- else
- {
- lcd.setCursor(11, 1);
- lcd.print("NO");
- Serial.write("Slaptazodis blogas");
- return false;
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement