title: U8glib slow simple test program on oled
body: <p>I'm trying to use u8glib on an arduino ethernet, in the first phase i need to display a simple countdown so in a little pretty way. To test if the display can be managed in time.</p>
  
  <p>I have to measure changes in order of milliseconds, likes 30ms, therefore i need that the countdown changes 1 units in about 50/100ms.</p>
  
  <p>This is the oled <a href="http://www.seeedstudio.com/wiki/Grove_-_OLED_Display_1.12%22" rel="nofollow">http://www.seeedstudio.com/wiki/Grove_-_OLED_Display_1.12%22</a></p>
  
  <p>Now im trying U8glib because has a lot of font integrated and it seems well documented.</p>
  
  <p>But the big problem is: The countdown, without sleep obiuvsly, is too slow! In order of 1 change in 1second.
  What i'm wrong? I need to change library?</p>
  
  <p>Thanks</p>
  
  <p>This is the code</p>
  
  <pre><code>#include "U8glib.h"
  
  U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE);  // I2C
  
  #define MAX_VAL  200
  #define MAX_VAL1 250
  #define MAX_VAL2 350
  #define MAX_VAL3 450
  #define MAX_VAL4 500
  
  int current_max_val  = MAX_VAL1;
  int currentBB = current_max_val;
  
  char bb_n[4] = {0,0,0,0};
  int bb_level = 4;
  
  
  static int last_bb_n = current_max_val;
  
  void draw(void) {
  
    int sizev = u8g.getStrWidth(bb_n);
    u8g.drawStr( (48 - (sizev/2)),60,bb_n);
  
    for(int i=0;i&lt;bb_level;i++){  
      u8g.drawTriangle((i*10)+0,90, (i*10)+10,90, (i*10)+5,85);
    }
    last_bb_n = currentBB;
    u8g.drawHLine(0,20, 96);
    u8g.drawHLine(0,70, 96);
  }
  
  void setup(void) {
  
    // flip screen, if required
    //u8g.setRot180();
  
    // set SPI backup if required
    //u8g.setHardwareBackup(u8g_backup_avr_spi);
  
    // assign default color value
    if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
      u8g.setColorIndex(255);     // white
    }
    else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) {
      u8g.setColorIndex(3);         // max intensity
    }
    else if ( u8g.getMode() == U8G_MODE_BW ) {
      u8g.setColorIndex(1);         // pixel on
    }
    else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
      u8g.setHiColorByRGB(255,255,255);
    }
    u8g.setFont(u8g_font_gdb30);
  }
  
  void loop(void) {
    // picture loop
    u8g.firstPage(); 
    count();
  
    do {
      draw();
    } while( u8g.nextPage() );
  
  }
  
  void count(){
    if(currentBB == 0){
     currentBB = current_max_val; 
    }
  
    itoa(currentBB,bb_n,10);
  
    if(currentBB &gt;= ((current_max_val/4)*3)){
      bb_level = 4;
    }else if((currentBB &lt; ((current_max_val/4)*3)) &amp;&amp; (currentBB &gt;= (current_max_val/4)*2)){
      bb_level = 3;
    }else if((currentBB &lt; ((current_max_val/4)*2))  &amp;&amp; (currentBB &gt;= (current_max_val/4))){
      bb_level = 2;
    }else if(currentBB &lt; (current_max_val/4)){
      bb_level = 1;
    }else{
      bb_level = 0;
    }
  
    currentBB--;
  </code></pre>