смотрится вот так
http://s2.uploads.ru/t/ZmEM9.jpg

lcd2004_bmp280_ds1307

#include <Wire.h>
#include <DS1307RTC.h>
#include <Time.h>
#include <LiquidCrystal_I2C.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>
#define BMP_CS 10

LiquidCrystal_I2C lcd(0x3f,20,4);
static byte addon_letters[16];
void init_rus(const char* letters_use )
{
  static byte letters[][8]   = {
        { B11110, B10000, B10000, B11110, B10001, B10001, B11110, B00000 },//Б
        { B11111, B10000, B10000, B10000, B10000, B10000, B10000, B00000 },//Г
        { B00110, B01010, B01010, B01010, B01010, B11111, B10001, B00000 },//Д
        { B10001, B10101, B10101, B01110, B10101, B10101, B10001, B00000 },//Ж
        { B01110, B10001, B00001, B00110, B00001, B10001, B01110, B00000 },//З
        { B10001, B10001, B10001, B10011, B10101, B11001, B10001, B00000 },//И
        { B10101, B10001, B10001, B10011, B10101, B11001, B10001, B00000 },//Й
        { B00110, B01001, B01001, B01001, B01001, B01001, B11001, B00000 },//Л
        { B11111, B10001, B10001, B10001, B10001, B10001, B10001, B00000 },//П
        { B10001, B10001, B10001, B01111, B00001, B10001, B01110, B00000 },//У
        { B01110, B10101, B10101, B10101, B01110, B00100, B00100, B00000 },//Ф
        { B10010, B10010, B10010, B10010, B10010, B10010, B11111, B00001 },//Ц
        { B10001, B10001, B10001, B01111, B00001, B00001, B00001, B00000 },//Ч
        { B10101, B10101, B10101, B10101, B10101, B10101, B11111, B00000 },//Ш
        { B10101, B10101, B10101, B10101, B10101, B10101, B11111, B00001 },//Щ
        { B10000, B10000, B10000, B11110, B10001, B10001, B11110, B00000 },//Ь
        { B11000, B01000, B01000, B01110, B01001, B01001, B01110, B00000 },//Ъ
        { B10001, B10001, B10001, B11001, B10101, B10101, B11001, B00000 },//Ы
        { B01110, B10001, B00001, B00111, B00001, B10001, B01110, B00000 },//Э
        { B10010, B10101, B10101, B11101, B10101, B10101, B10010, B00000 },//Ю
        { B01111, B10001, B10001, B01111, B00101, B01001, B10001, B00000 },//Я
        { B00110, B01001, B01001, B00110, B00000, B00000, B00000, B00000 },//г
  };
  static char chars[] = {'Б','Г','Д','Ж','З','И','Й','Л','П','У','Ф','Ц','Ч','Ш','Щ','Ь','Ъ','Ы','Э','Ю','Я','г'};
  static byte empty[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
  int index = 0, cl = sizeof(chars)/sizeof(char),i,j,symb;
  memset(addon_letters,0,sizeof(addon_letters));
  for( j = 0; j < strlen(letters_use) && j < 16; j++ )

          lcd.createChar(j, empty);

  for( j = 0; j < strlen(letters_use) && j < 16; j++ )
  {
          symb = -1;
          for( i=0; i < cl; i++ ) if( chars[i] == letters_use[j] ) { symb = i; addon_letters[index] = letters_use[j]; break; }
          if( symb != -1 ) { lcd.createChar(index, letters[symb]); index++; }
  }
}
void print_rus(char *str) {
  static char rus_letters[] = {'А','В','Е','Ё','К','М','Н','О','Р','С','Т','Х'};
  static char trans_letters[] = {'A','B','E','E','K','M','H','O','P','C','T','X'};
  int lcount = sizeof(rus_letters)/sizeof(char), i, j;
  for( i=0; i<strlen(str); i++ )
  {
        if( byte(str[i]) == 208 ) continue; // 208 ignore
        int found = 0;
        for(j=0; j < 16; j++) if( addon_letters[j] != 0 && byte(str[i]) == byte(addon_letters[j]) ) { lcd.write(j); found = 1; break; }
        if(!found) for(j=0; j < lcount; j++) if( byte(str[i]) == byte(rus_letters[j]) ) { lcd.write(trans_letters[j]); found = 1; break; }
        if(!found) lcd.write(byte(str[i]));
  } 
}
void print_rus(int x, int y, char *str) {
  lcd.setCursor(x, y);
  print_rus(str);
}
Adafruit_BMP280 bmp(BMP_CS);
void setup()
{
bmp.begin(9600);
lcd.init();
lcd.begin(20, 4);
lcd.backlight();
init_rus("ПУДЛИГЯг");
}
void loop()
{
tmElements_t tm;
RTC.read(tm);
lcd.setCursor(2, 1);
print_rus("ВРЕМЯ - ");
print2digits(tm.Hour);
lcd.print(":");
print2digits(tm.Minute);
lcd.print(":");
print2digits(tm.Second);
lcd.print(" ");
lcd.setCursor(0, 0);
print_rus("СЕГОДНЯ-");
print2digits(tm.Day);
lcd.print(".");
print2digits(tm.Month);
lcd.print(".");
lcd.print(tmYearToCalendar(tm.Year));
print_rus(" Г");
lcd.setCursor(0, 2);
print_rus("ТЕМПЕРАТУРА-");
lcd.print(bmp.readTemperature());
print_rus("г С");
lcd.setCursor(1, 3);
print_rus("ДАВЛЕНИЕ-");
lcd.print(bmp.readPressure()/133.322);
print_rus(" ММ");
delay(1000);
}
void print2digits(int number) {
if (number >= 0 && number < 10) {
lcd.print('0');
}
lcd.print(number);
}

Отредактировано besteugen (2017-10-13 02:41:07)