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


#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);

int button = 2;

void setup() {
  pinMode(button, INPUT_PULLUP);

  lcd.init();
  lcd.backlight();

  randomSeed(analogRead(A0));

  lcd.setCursor(0, 0);
  lcd.print("Press button!");
}

void loop() {
  if (digitalRead(button) == LOW) {
    int number = random(1, 7);

    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Your number:");

    lcd.setCursor(0, 1);
    lcd.print(number);

    delay(300);

    while (digitalRead(button) == LOW) {
      delay(10);
    }
  }
}