/* Smooth Big Text - see http://www.technoblogy.com/show?3AJ7 David Johnson-Davies - www.technoblogy.com - 21st October 2020 ATtiny85 @ 1 MHz (internal oscillator; BOD disabled) CC BY 4.0 Licensed under a Creative Commons Attribution 4.0 International license: http://creativecommons.org/licenses/by/4.0/ */ #include #include // OLED I2C 128 x 32 monochrome display ********************************************** const int OLEDAddress = 0x3C; // Initialisation sequence for OLED module int const InitLen = 15; const unsigned char Init[InitLen] PROGMEM = { 0xA8, // Set multiplex 0x1F, // for 32 rows 0x8D, // Charge pump 0x14, 0x20, // Memory mode 0x01, // Vertical addressing 0xA1, // 0xA0/0xA1 flip horizontally 0xC8, // 0xC0/0xC8 flip vertically 0xDA, // Set comp ins 0x02, 0xD9, // Set pre charge 0xF1, 0xDB, // Set vcom deselect 0x40, 0xAF // Display on }; const int data = 0x40; const int single = 0x80; const int command = 0x00; void InitDisplay () { Wire.beginTransmission(OLEDAddress); Wire.write(command); for (uint8_t c=0; c=0; i--) { for (int j=1; j<3; j++) { if (((col0>>i & 0b11) == (3-j)) && ((col1>>i & 0b11) == j)) { col0R = col0R | 1<<((i*2)+j); col1L = col1L | 1<<((i*2)+3-j); } } } } Wire.write(col0L); Wire.write(col0L>>8); Wire.write(col0R); Wire.write(col0R>>8); col0L = col1L; col0R = col1R; } col0 = col1; } if (Scale == 1) Wire.write(col0); else { Wire.write(col0L); Wire.write(col0L>>8); Wire.write(col0R); Wire.write(col0R>>8); } Wire.endTransmission(); } // Plot text starting at the current plot position void PlotText(PGM_P s, int line, int column) { int p = (int)s; while (1) { char c = pgm_read_byte(p++); if (c == 0) return; PlotChar(c, line, column); column = column + Scale*6; } } // Setup ********************************************** void setup() { Wire.begin(); InitDisplay(); ClearDisplay(); Scale = 2; } void loop() { Smooth = true; PlotText(PSTR("ABCDEFGHIJ"), 0, 0); PlotText(PSTR("0123456789"), 2, 0); delay(10000); Smooth = false; PlotText(PSTR("ABCDEFGHIJ"), 0, 0); PlotText(PSTR("0123456789"), 2, 0); delay(10000); }