Go Down

Topic: u8glib sdd1306 oled slow (Read 226 times) previous topic - next topic

robse

Here we are.

Just tested the sdd1306 display with the adafruit library

from 0 to 100 it takes 4,3 seconds, half of the u8glib (well, the font is uglier)

I'll switch to SPI.

Code following below.

Code: [Select]

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define OLED_RESET 0
Adafruit_SSD1306 display(OLED_RESET);

void setup()   {                
  Serial.begin(9600);

  // by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3D (for the 128x64)
  // init done
  
  // Show image buffer on the display hardware.
  // Since the buffer is intialized with an Adafruit splashscreen
  // internally, this will display the splashscreen.
  display.display();
  delay(2000);

  // Clear the buffer.
  display.clearDisplay();
}


void loop() {
  
  int x;
  char buf[5];
  unsigned int initial = 0;
  unsigned int final = 0;
  
  initial = millis();
  display.clearDisplay();
  for (x=0; x<=100; x++) {
    display.setTextSize(5);
    display.setTextColor(WHITE);
    display.setCursor(0,15);
    display.print(itoa(x, buf, 10));
    display.display();
    display.clearDisplay();
  }
  final = millis();
  Serial.println(final-initial);
  delay(4000);
}


Go Up