Відповісти

Введіть повідомлення і натисніть Надіслати
Параметри

Назад

Огляд теми (нові повідомленні вгорі)

daa_sasha
2019-02-14 16:32:27

Спасибо

ard125
2019-02-14 14:04:50

Выкинь тяжеловесную каку и поставь простенькую библиотеку http://arduino.ru/forum/proekty/asoled-kompaktnaya-biblioteka-dlya-oled-displeya-128kh64-s-kirillitsei-utf-8

NoName
2019-02-14 12:29:47

написать свой U8GLIB_SH1106_128X64
шрифт дам. развлекайтесь

const char font [][5] = 
{


 {0x00,0x00,0x00,0x00,0x00},                    //пробел code 32 0x20
 {0x00,0x00,0x4f,0x00,0x00},                    //!      code 33
 {0x00,0x07,0x00,0x07,0x00},                    //"
 {0x14,0x7f,0x14,0x7f,0x14},                    //#
 {0x24,0x2a,0x7f,0x2a,0x12},                    //$
 {0x23,0x13,0x08,0x64,0x62},                    //%
 {0x36,0x49,0x55,0x22,0x40},                    //&
 {0x00,0x05,0x03,0x00,0x00},                    //,
 {0x00,0x1c,0x22,0x41,0x00},                    //(
 {0x00,0x41,0x22,0x1c,0x00},                    //)
 {0x14,0x08,0x3E,0x08,0x14},                    //*
 {0x08,0x08,0x3E,0x08,0x08},                    //+
 {0x00,0x50,0x30,0x00,0x00},                    //,
 {0x08,0x08,0x08,0x08,0x08},                    //-
 {0x00,0x60,0x60,0x00,0x00},                    //.
 {0x20,0x10,0x08,0x04,0x02},                    ///
 
 {0x3e,0x51,0x49,0x45,0x3e},                    //0 code   0x30 
 {0x00,0x42,0x7f,0x40,0x00},                    //1
 {0x42,0x61,0x51,0x49,0x46},                    //2
 {0x21,0x41,0x45,0x4b,0x31},                    //3
 {0x18,0x14,0x12,0x7f,0x10},                    //4
 {0x27,0x45,0x45,0x45,0x39},                    //5
 {0x3c,0x4a,0x49,0x49,0x30},                    //6
 {0x01,0x71,0x09,0x05,0x03},                    //7
 {0x36,0x49,0x49,0x49,0x36},                    //8
 {0x06,0x49,0x49,0x29,0x1e},                    //9
 {0x00,0x36,0x36,0x00,0x00},                    //:
 {0x00,0x56,0x36,0x00,0x00},                    //;
 {0x08,0x14,0x22,0x41,0x00},                    //<
 {0x14,0x14,0x14,0x14,0x14},                    //=
 {0x00,0x41,0x22,0x14,0x08},                    //>
 {0x02,0x01,0x51,0x09,0x06},                    //?

 {0x32,0x49,0x71,0x41,0x3e},                    //@ code   0x40
 {0x7e,0x11,0x11,0x11,0x7e},                    //A
 {0x7f,0x49,0x49,0x49,0x36},                    //B
 {0x3e,0x41,0x41,0x41,0x22},                    //C
 {0x7f,0x41,0x41,0x22,0x1c},                    //D
 {0x7f,0x49,0x49,0x49,0x41},                    //E
 {0x7f,0x09,0x09,0x09,0x01},                    //F
 {0x3e,0x41,0x49,0x49,0x3a},                    //G
 {0x7f,0x08,0x08,0x08,0x7f},                    //H
 {0x00,0x41,0x7f,0x41,0x00},                    //I
 {0x20,0x40,0x41,0x3f,0x01},                    //J
 {0x7f,0x08,0x14,0x22,0x41},                    //K
 {0x7f,0x40,0x40,0x40,0x40},                    //L
 {0x7f,0x02,0x0c,0x02,0x7f},                    //M
 {0x7f,0x04,0x08,0x10,0x7f},                    //N
 {0x3e,0x41,0x41,0x41,0x3e},                    //O
 

 {0x7f,0x09,0x09,0x09,0x06},                    //P code   0x50
 {0x3e,0x41,0x51,0x21,0x5e},                    //Q
 {0x7f,0x09,0x19,0x29,0x46},                    //R
 {0x46,0x49,0x49,0x49,0x31},                    //S
 {0x01,0x01,0x7f,0x01,0x01},                    //T
 {0x3f,0x40,0x40,0x40,0x3f},                    //U
 {0x1f,0x20,0x40,0x20,0x1f},                    //V
 {0x3f,0x40,0x70,0x40,0x3f},                    //W
 {0x63,0x14,0x08,0x14,0x63},                    //X
 {0x07,0x08,0x70,0x08,0x07},                    //Y
 {0x61,0x51,0x49,0x45,0x43},                    //Z
 {0x00,0x7F,0x41,0x41,0x00},                    //[
 {0x02,0x04,0x08,0x10,0x20},                    //\ 
 {0x00,0x41,0x41,0x7F,0x00},                    //]
 {0x04,0x02,0x01,0x02,0x04},                    //^
 {0x40,0x40,0x40,0x40,0x40},                    //_

 {0x00,0x01,0x02,0x04,0x00},                    //' code   0x60
 {0x20,0x54,0x54,0x54,0x78},                    //a
 {0x7F,0x48,0x44,0x44,0x38},                    //b
 {0x38,0x44,0x44,0x44,0x20},                    //c
 {0x38,0x44,0x44,0x48,0x7F},                    //d
 {0x38,0x54,0x54,0x54,0x18},                    //e
 {0x08,0x7E,0x09,0x01,0x02},                    //f
 {0x0C,0x52,0x52,0x52,0x3E},                    //g
 {0x7F,0x08,0x04,0x04,0x78},                    //h
 {0x00,0x44,0x7D,0x40,0x00},                    //i
 {0x20,0x40,0x44,0x3D,0x00},                    //j
 {0x7F,0x10,0x28,0x44,0x00},                    //k
 {0x00,0x41,0x7F,0x40,0x00},                    //l
 {0x7C,0x04,0x18,0x04,0x78},                    //m
 {0x7C,0x08,0x04,0x04,0x78},                    //n
 {0x38,0x44,0x44,0x44,0x38},                    //o
 

 {0x7C,0x14,0x14,0x14,0x08},                    //p code   0x70
 {0x08,0x14,0x14,0x18,0x7C},                    //q
 {0x7C,0x08,0x04,0x04,0x08},                    //r
 {0x48,0x54,0x54,0x54,0x20},                    //s
 {0x04,0x3F,0x44,0x40,0x20},                    //t
 {0x3C,0x40,0x40,0x20,0x7C},                    //u
 {0x1C,0x20,0x40,0x20,0x1C},                    //v
 {0x3C,0x40,0x30,0x40,0x3C},                    //w
 {0x44,0x28,0x10,0x28,0x44},                    //x
 {0x0C,0x50,0x50,0x50,0x3C},                    //y
 {0x44,0x64,0x54,0x4C,0x44},                    //z
 {0x00,0x08,0x36,0x41,0x00},                    //{
 {0x00,0x00,0x7f,0x00,0x00},                    //|
 {0x00,0x41,0x36,0x08,0x00},                    //}
 {0x02,0x01,0x02,0x02,0x01},                    //~
 {0x00,0x00,0x00,0x00,0x00},                    //резерв
 // 0x7f 


 {0x00,0x00,0x00,0x00,0x00},                    // reserve code 0x80
 {0x00,0x00,0x00,0x00,0x00}, 
 {0x00,0x00,0x00,0x00,0x00},
 {0x00,0x00,0x00,0x00,0x00}, 
 {0x00,0x00,0x00,0x00,0x00},
 {0x00,0x00,0x00,0x00,0x00}, 
 {0x00,0x00,0x00,0x00,0x00},
 {0x00,0x00,0x00,0x00,0x00}, 
 {0x00,0x00,0x00,0x00,0x00},
 {0x00,0x00,0x00,0x00,0x00}, 
 {0x00,0x00,0x00,0x00,0x00},
 {0x00,0x00,0x00,0x00,0x00}, 
 {0x00,0x00,0x00,0x00,0x00},
 {0x00,0x00,0x00,0x00,0x00}, 
 {0x00,0x00,0x00,0x00,0x00},
 {0x00,0x00,0x00,0x00,0x00}, 

 {0x00,0x00,0x00,0x00,0x00},                    // reserve code 0x90
 {0x00,0x00,0x00,0x00,0x00}, 
 {0x00,0x00,0x00,0x00,0x00},
 {0x00,0x00,0x00,0x00,0x00}, 
 {0x00,0x00,0x00,0x00,0x00},
 {0x00,0x00,0x00,0x00,0x00}, 
 {0x00,0x00,0x00,0x00,0x00},
 {0x00,0x00,0x00,0x00,0x00}, 
 {0x00,0x00,0x00,0x00,0x00},
 {0x00,0x00,0x00,0x00,0x00}, 
 {0x00,0x00,0x00,0x00,0x00},
 {0x00,0x00,0x00,0x00,0x00}, 
 {0x00,0x00,0x00,0x00,0x00},
 {0x00,0x00,0x00,0x00,0x00}, 
 {0x00,0x00,0x00,0x00,0x00},
 {0x00,0x00,0x00,0x00,0x00}, 

 {0x00,0x00,0x00,0x00,0x00},                    // reserve code 0xA0
 {0x00,0x00,0x00,0x00,0x00},                    // reserve code 0xA1
 {0x00,0x00,0x00,0x00,0x00},                    // reserve code 0xA2
 {0x00,0x00,0x00,0x00,0x00},                    // reserve code 0xA3 
 {0x00,0x00,0x00,0x00,0x00},                    // reserve code 0xA4
 {0x00,0x00,0x00,0x00,0x00},                    // reserve code 0xA5 
 {0x00,0x00,0x00,0x00,0x00},                    // reserve code 0xA6
 {0x00,0x00,0x00,0x00,0x00},                    // reserve code 0xA7 
 {0x00,0x00,0x00,0x00,0x00},                    // reserve code 0xA8
 {0x00,0x00,0x00,0x00,0x00},                    // reserve code 0xA9 
 {0x00,0x00,0x00,0x00,0x00},                    // "Є" code 0xAA
 {0x00,0x00,0x00,0x00,0x00},                    // reserve code 0xAB 
 {0x00,0x00,0x00,0x00,0x00},                    // reserve code 0xAC
 {0x00,0x00,0x00,0x00,0x00},                    // reserve code 0xAD 
 {0x00,0x00,0x00,0x00,0x00},                    // reserve code 0xAE
 {0x00,0x00,0x00,0x00,0x00},                    // "Ї" 0xAF 

 {0x00,0x00,0x00,0x00,0x00},                    // reserve code 0xB0
 {0x00,0x00,0x00,0x00,0x00},                    // reserve code 0xB1
 {0x00,0x00,0x00,0x00,0x00},                    // reserve code 0xB2
 {0x00,0x00,0x00,0x00,0x00},                    // reserve code 0xB3 
 {0x00,0x00,0x00,0x00,0x00},                    // reserve code 0xB4
 {0x00,0x00,0x00,0x00,0x00},                    // reserve code 0xB5 
 {0x00,0x00,0x00,0x00,0x00},                    // reserve code 0xB6
 {0x00,0x00,0x00,0x00,0x00},                    // reserve code 0xB7 
 {0x00,0x00,0x00,0x00,0x00},                    // reserve code 0xB8
 {0x00,0x00,0x00,0x00,0x00},                    // reserve code 0xB9 
 {0x00,0x00,0x00,0x00,0x00},                    // "є" code 0xBA
 {0x00,0x00,0x00,0x00,0x00},                    // reserve code 0xBB 
 {0x00,0x00,0x00,0x00,0x00},                    // reserve code 0xBC
 {0x00,0x00,0x00,0x00,0x00},                    // reserve code 0xBD 
 {0x00,0x00,0x00,0x00,0x00},                    // reserve code 0xBE
 {0x00,0x00,0x00,0x00,0x00},                    // "ї" 0xBF 

 {0x7e,0x11,0x11,0x11,0x7e},                    //A code   0xС0
 {0x7f,0x49,0x49,0x49,0x33},                    //Б
 {0x7f,0x49,0x49,0x49,0x36},                    //В
 {0x7f,0x01,0x01,0x01,0x03},                    //Г
 {0xe0,0x51,0x4f,0x41,0xff},                    //Д
 {0x7f,0x49,0x49,0x49,0x41},                    //E
 {0x77,0x08,0x7f,0x08,0x77},                    //Ж
 {0x41,0x49,0x49,0x49,0x36},                    //З
 {0x7f,0x10,0x08,0x04,0x7f},                    //И
 {0x7c,0x21,0x12,0x09,0x7c},                    //Й
 {0x7f,0x08,0x14,0x22,0x41},                    //K
 {0x20,0x41,0x3f,0x01,0x7f},                    //Л
 {0x7f,0x02,0x0c,0x02,0x7f},                    //M
 {0x7f,0x08,0x08,0x08,0x7f},                    //H
 {0x3e,0x41,0x41,0x41,0x3e},                    //O
 {0x7f,0x01,0x01,0x01,0x7f},                    //П
 
 {0x7f,0x09,0x09,0x09,0x06},                    //P code   0xD0
 {0x3e,0x41,0x41,0x41,0x22},                    //C
 {0x01,0x01,0x7f,0x01,0x01},                    //T
 {0x47,0x28,0x10,0x08,0x07},                    //У
 {0x1c,0x22,0x7f,0x22,0x1c},                    //Ф
 {0x63,0x14,0x08,0x14,0x63},                    //X
 {0x7f,0x40,0x40,0x40,0xff},                    //Ц
 {0x07,0x08,0x08,0x08,0x7f},                    //Ч
 {0x7f,0x40,0x7f,0x40,0x7f},                    //Ш
 {0x7f,0x40,0x7f,0x40,0xff},                    //Щ
 {0x01,0x7f,0x48,0x48,0x30},                    //Ъ
 {0x7f,0x48,0x30,0x00,0x7f},                    //Ы
 {0x00,0x7f,0x48,0x48,0x30},                    //Э
 {0x22,0x41,0x49,0x49,0x3e},                    //Ь
 {0x7f,0x08,0x3e,0x41,0x3e},                    //Ю
 {0x46,0x29,0x19,0x09,0x7f},                    //Я
 
 {0x20,0x54,0x54,0x54,0x78},                    //a code   0xE0
 {0x3c,0x4a,0x4a,0x49,0x31},                    //б
 {0x7c,0x54,0x54,0x28,0x00},                    //в
 {0x7c,0x04,0x04,0x04,0x0c},                    //г
 {0xe0,0x54,0x4c,0x44,0xfc},                    //д
 {0x38,0x54,0x54,0x54,0x18},                    //e
 {0x6c,0x10,0x7c,0x10,0x6c},                    //ж
 {0x44,0x44,0x54,0x54,0x28},                    //з
 {0x7c,0x20,0x10,0x08,0x7c},                    //и
 {0x7c,0x41,0x22,0x11,0x7c},                    //й
 {0x7c,0x10,0x28,0x44,0x00},                    //к
 {0x20,0x44,0x3c,0x04,0x7c},                    //л
 {0x7c,0x08,0x10,0x08,0x7c},                    //м
 {0x7c,0x10,0x10,0x10,0x7c},                    //н
 {0x38,0x44,0x44,0x44,0x38},                    //o
 {0x7c,0x04,0x04,0x04,0x7c},                    //п
 
 {0x7C,0x14,0x14,0x14,0x08},                    //p code   0xF0 
 {0x38,0x44,0x44,0x44,0x20},                    //c
 {0x04,0x04,0x7c,0x04,0x04},                    //т
 {0x0C,0x50,0x50,0x50,0x3C},                    //у
 {0x30,0x48,0xfc,0x48,0x30},                    //ф
 {0x44,0x28,0x10,0x28,0x44},                    //x
 {0x7c,0x40,0x40,0x40,0xfc},                    //ц
 {0x0c,0x10,0x10,0x10,0x7c},                    //ч
 {0x7c,0x40,0x7c,0x40,0x7c},                    //ш
 {0x7c,0x40,0x7c,0x40,0xfc},                    //щ
 {0x04,0x7c,0x50,0x50,0x20},                    //ъ
 {0x7c,0x50,0x50,0x20,0x7c},                    //ы
 {0x7c,0x50,0x50,0x20,0x00},                    //ь
 {0x28,0x44,0x54,0x54,0x38},                    //э
 {0x7c,0x10,0x38,0x44,0x38},                    //ю
 {0x08,0x54,0x34,0x14,0x7c},                    //я
 
};
daa_sasha
2019-02-14 11:53:26

Здравствуйте.
Написал такой скетч для отображения температур с датчиков DS18B20 на OLED дисплея 128X64. Можно как-то его уменьшить чтобы уместить в mega8. Я только начал по немного разбираться в программировании. Можно уменьшить за счет шрифтов но как удалить не нужные буквы со шрифта я не могу понять. Отказаться от DallasTemperature.h не могу так как использую поиск и задание датчиков.
Помогите. Кто что посоветует.

#include <U8glib.h>
//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9);	// SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7);	// SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST);	// Dev 0, Fast I2C / TWI
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK);	// Display which does not send ACK

#include <rus8x13.h>
#include <rus10x20.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 3 // вывод, к которому подключён DS18B20
#define TEMPERATURE_PRECISION 12 // точность измерений (9 ... 12)

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensor(&oneWire);
DeviceAddress Thermometer1;
DeviceAddress Thermometer2;
float temp1 = 0.0; // текущее значение температуры
float temp2 = 0.0; // текущее значение температуры

void setup() {
  sensor.begin(); // инициализация DS18B20
  sensor.getAddress(Thermometer1, 0); // адрес DS18B20 (поиск по индексу)
  sensor.getAddress(Thermometer2, 1);
  sensor.setResolution(Thermometer1, TEMPERATURE_PRECISION);// установка точности измерения 9...12 разрядов
  sensor.setResolution(Thermometer2, TEMPERATURE_PRECISION);
}
//void draw(void) {
 void loop(void) { 
  sensor.requestTemperatures(); // считывание значение температуры
  temp1 = sensor.getTempC(Thermometer1); // температура в градусах Цельсия
  temp2 = sensor.getTempC(Thermometer2);
     u8g.firstPage();
     do {
      //u8g.setColorIndex(1);
      u8g.setFont(rus8x13);
      u8g.setPrintPos(38,13); u8g.print("Салон");
      u8g.setFont(rus10x20);
      u8g.setPrintPos(10,32); u8g.print(temp1);
      u8g.drawCircle(85,16,2);
      u8g.setPrintPos(89,32); u8g.print("C");
      u8g.setFont(rus8x13);
      u8g.setPrintPos(38,44); u8g.print("Улица");
      u8g.setFont(rus10x20);
      u8g.setPrintPos(10,64); u8g.print(temp2);
      u8g.drawCircle(85,48,3);
      u8g.setPrintPos(89,64); u8g.print("C");
      }    while (u8g.nextPage());
      }

Підвал форуму