Загрузка данных


#include <Keypad.h>

const byte ROWS = 4;
const byte COLS = 4;

char keys[ROWS][COLS] = {
  {'1', '2', '3', 'A'},  // S1, S2, S3, S4
  {'4', '5', '6', 'B'},  // S5, S6, S7, S8
  {'7', '8', '9', 'C'},  // S9, S10, S11, S12
  {'X', '0', '*', 'E'}   // S13 (Сброс), S14 (0), S15 (*), S16 (Enter)
};

byte rowPins[ROWS] = {2, 3, 4, 5}; 
byte colPins[COLS] = {6, 7, 8, 9}; 

Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);

const String correctPass = "1234"; // Пароль: S1 -> S2 -> S3 -> S4
String enteredPass = "";

void setup() {
  Serial.begin(9600);
}

void loop() {
  char key = keypad.getKey();
  
  if (key) {
    if (key == 'E') { // Кнопка S16 (Ввод)
      if (enteredPass == correctPass) {
        Serial.println("PLAY"); // СИГНАЛ НА ЗАПУСК ВИДЕО
      }
      enteredPass = "";
    } 
    else if (key == 'X') { // Кнопка S13 (Сброс)
      enteredPass = "";
    } 
    else {
      if (enteredPass.length() < 10) {
        enteredPass += key;
      }
    }
  }
}