USING u8glib to display text

Hi there,

I want to display some text using the u8glib library on my display which changes after 2.5 seconds to something else and then after another 2.5 seconds back to the original text. However, I cannot manage to clear the screen in between so the texts just overwrite each other and then after the first loop it just appears to be constant as the texts just keep overwriting each other with every loop. This is what I have done so far, any help is appreciated:

#include "U8glib.h"

U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);

void draw(void) {
u8g.setFont(u8g_font_unifont);
u8g.setPrintPos(0, 10);
u8g.print("First Text 1st Line");
u8g.setPrintPos(0, 30);
u8g.print("First Text 2nd Line");

delay(2500);

u8g.setPrintPos(0, 10);
u8g.print("Second Text 1st Line");
u8g.setPrintPos(0, 30);
u8g.print("Second Text 1st Line");

delay(2500);
}
void setup(void) {
// flip screen, if required
// u8g.setRot180();

// 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);
}
}

void loop(void) {
// picture loop
u8g.firstPage();
do {
draw();
}
while( u8g.nextPage() );

// rebuild the picture after some delay
delay(5000);
}

Display_Test.ino (1.21 KB)

All the stuff to be dsiplayed needs to be in the loop:

for instance:

void loop() {

display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.print("Hello");
display.setCursor(0,16);
display.print("World");

for (j=100; j<131; j++){
display.drawPixel(j,10, WHITE);
}
for (j=2; j<32; j++){
display.drawPixel(115,j, WHITE);
}

display.drawLine(0,31,128,31, WHITE);

display.drawCircle(110,17,10, WHITE);

display.display();

}