User Tools

Site Tools


arduino:displays_for_classic_arduinos:display_ssd1306_oled_u8glib.ino

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
arduino:displays_for_classic_arduinos:display_ssd1306_oled_u8glib.ino [2018/01/28 04:05] – created mithatarduino:displays_for_classic_arduinos:display_ssd1306_oled_u8glib.ino [2018/01/28 04:09] (current) mithat
Line 1: Line 1:
 +<file c++ display_SSD1306_OLED_u8glib.ino>
 /* /*
- display_SSD1306_OLED_u8g2.ino+ display_SSD1306_OLED_u8glib.ino
  *    *  
  * Test screen update speed with large solid fonts on   * Test screen update speed with large solid fonts on 
  * a 128x64 OLED screen that uses the SD1306 chip.  * a 128x64 OLED screen that uses the SD1306 chip.
    
- * Consumes 46% of program storage space and + * Consumes 56% of program storage space and 
- 28% of dynamic memory on a Nano.+ 13% of dynamic memory on a Nano.
  *    *  
  * Mithat Konar  * Mithat Konar
  */  */
  
-#include <U8g2lib.h>+ 
 +#include "U8glib.h"
  
 /* /*
Line 30: Line 32:
                    RESET_PIN = 8;                    RESET_PIN = 8;
  
-U8G2_SSD1306_128X64_NONAME_1_4W_HW_SPI disp = U8G2_SSD1306_128X64_NONAME_1_4W_HW_SPI(U8G2_R0, CS_PIN, DC_PIN, RESET_PIN);+U8GLIB_SSD1306_128X64 disp(CS_PIN, DC_PIN, RESET_PIN);   // HW SPI
  
 unsigned int counter = 80; unsigned int counter = 80;
Line 36: Line 38:
  
 void setup(void) { void setup(void) {
-  disp.begin(); 
   disp.setColorIndex(1);   disp.setColorIndex(1);
 } }
Line 42: Line 43:
 void loop(void) { void loop(void) {
   counter = (counter + 1) % 1000;   counter = (counter + 1) % 1000;
-    +  
   // picture loop   // picture loop
   disp.firstPage();   disp.firstPage();
   do {   do {
-    disp.setFont(u8g2_font_6x13_tr); +     
-    disp.drawStr(0, 13, "SSD1306 u8g2");+    disp.setFont(u8g_font_unifont); 
 +    disp.drawStr(0, 13, "SSD1306 u8glib");
  
-    disp.setFont(u8g2_font_logisoso46_tr);+    disp.setFont(u8g_font_fub25r);  // the largest font with chars that ships w/ lib
     String(counter).toCharArray(dispStr, 4);     String(counter).toCharArray(dispStr, 4);
     disp.drawStr( 0, 63, dispStr);     disp.drawStr( 0, 63, dispStr);
   } while ( disp.nextPage() );   } while ( disp.nextPage() );
  
-  /* inherent frame rate is about 13 fps with 16 MHz processor  +  // rebuild the picture after some delay
-     (without additional delay). */+
   delay(500);   delay(500);
 } }
- +</file>
arduino/displays_for_classic_arduinos/display_ssd1306_oled_u8glib.ino.1517112345.txt.gz · Last modified: 2018/01/28 04:05 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki