Go Down

Topic: graphics display issue with u8glib (Read 116 times) previous topic - next topic

jgko

Hello,
I am trying to use the 12864B display with the u8glib library. I run into one problem though. The display gets initialized in the setup procedure:
Code: [Select]
void setup(void)
{
analogReference(EXTERNAL);

Serial.begin(9600);
rtc.begin(); // Initialize the rtc object
    u8g.setFont(u8g_font_6x12);
  u8g.firstPage(); 
  do {
    u8g.drawStr( 0, 8, "Monitor V1.2");
    u8g.setPrintPos(0, 17);
    u8g.print(rtc.getDateStr());
    u8g.setPrintPos(70, 17);
    u8g.print(rtc.getTimeStr());
  } while( u8g.nextPage() );
}

Which displays the information correctly.
The display is being called again in the loop section to update the sensor infos:

Code: [Select]
  if (Sensor1.getTemperature(&temperature)) {
    Serial.print("uint_16: ");
    Serial.println(temperature);
    Temperatur_C = Sensor1.calc_Celsius(&temperature);
    Serial.print("Temperature: ");
    Serial.print(Temperatur_C, 2);
    Serial.println(" °C");
   u8g.firstPage(); 
  do {}
  while( u8g.nextPage() );
 
  u8g.firstPage(); 
  do {
    draw();
  } while( u8g.nextPage() );
  }
  else {
      u8g.firstPage();
    Serial.println("No Sensordata!");
    do {
    u8g.drawStr(0, 20, "No Sensordata!");
    }    while( u8g.nextPage() );   
  }
delay(800);

This information never gets displayed. The info from the setup routine remains displayed. When I disable the code in the setup section, all information asked for in the loop section will show up.
Can somebody please tell me, what I am overlooking or why the display cannot be initialized and then called up again?
Thank you in advance for any possible help with this.
Joe

Go Up