char array in u8glib

Hi Oliver,

I try to write some sample codes with u8glib, there are two sample codes and I have a strange issue.
The example 2 is a regular code from u8glib, it has a good work.
The example 1 is that I try to use a char array as my string storage and drawStr() read it. As the example 1 video you can see, the screen is flash and it should display again when I power off/on(unplug/plug the white line) the OLED again and again.
BTW, there is an external power supply for OLED.

Here are the video and codes.

thanks!

Example 1 video: - YouTube
Example 2 video: - YouTube

Example 1 codes....

int pp=12;
char str1[8];


void loop(void) {

  if(pp == 60)
    pp =12;
    
  sprintf(str1, "str1=%d", pp);
  
  u8g.firstPage();  
  do {
    u8g.setFont(u8g_font_unifont);
    u8g.drawStr(0, pp, str1); 
  } while( u8g.nextPage() );
  
  delay(250);
  pp++;
}

Example 2....

int y_pos = 0;

void loop(void) {

  if(y_pos == 60)
    y_pos = 0;

  u8g.firstPage();  
  do {
      u8g.setFont(u8g_font_unifont);
      u8g.drawStr( 0, y_pos, "Hello World!");
  } while( u8g.nextPage() );

  y_pos++; 
  delay(250);
}

How is the white line connected in the video? Is it just the backlight LED?
What constructor is used in the examples? What is the exact type of the Display?

What is the error? From the video it seems that the display turns off after some time. Is this the unintended behaviour?

Oliver

olikraus:
How is the white line connected in the video? Is it just the backlight LED?
What constructor is used in the examples? What is the exact type of the Display?

What is the error? From the video it seems that the display turns off after some time. Is this the unintended behaviour?

Oliver

White line is Vss pin, it connected to SSD1325 pin 1.
The constructor is U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9, 2), I use arduino mini pro.
The type of OLED is SSD1325(datasheet:http://www.dfrobot.com.cn/download/TW28642270B.pdf)
Yes, the unintended behavior is in video 1, I power on the OLED, the screen only display about ~1 second and then disappear, it is not normal behavior in my code. Compare with video 2, I did not plug/unplug white line, it always work fine.

thanks.

By the way... Maybe the OLED is not compatible with the u8glib.
If I want to buy a new OLED, I searched this http://tw.mouser.com/Search/Refine.aspx?Keyword=NHD-2.7
Does it compatible with the u8glib? or others OLED what you proposed and where to buy?

thanks!

liming:
By the way... Maybe the OLED is not compatible with the u8glib.
If I want to buy a new OLED, I searched this http://tw.mouser.com/Search/Refine.aspx?Keyword=NHD-2.7
Does it compatible with the u8glib? or others OLED what you proposed and where to buy?

thanks!

Indeed i tested u8glib with the NHD OLED.
What looks strange to me is, that the screen goes black but goes to normal state after you connect the display to power again. In fact the software and the uC do work like nothing has happend. From that perspective, i have some doubts that this is an software issue.

Maybe you can do another test: Please add u8g.setContrast() to your program. The font should be come dark. Try repeating your example with different values of u8g.setContrast(). Idea is this: The display requires a lot of current. Maybe everything works with lesser current (lower values for u8g.setContrast()).

Oliver

olikraus:

liming:
By the way... Maybe the OLED is not compatible with the u8glib.
If I want to buy a new OLED, I searched this NHD-2.7 OLED顯示器和配件 的搜尋結果 - 貿澤 臺灣
Does it compatible with the u8glib? or others OLED what you proposed and where to buy?

thanks!

Indeed i tested u8glib with the NHD OLED.
What looks strange to me is, that the screen goes black but goes to normal state after you connect the display to power again. In fact the software and the uC do work like nothing has happend. From that perspective, i have some doubts that this is an software issue.

Maybe you can do another test: Please add u8g.setContrast() to your program. The font should be come dark. Try repeating your example with different values of u8g.setContrast(). Idea is this: The display requires a lot of current. Maybe everything works with lesser current (lower values for u8g.setContrast()).

Oliver

I have tried u8g.setContrast(50) and u8g.setContrast(5), the font is dark. But the issue is the same, the fonts appear and then disappear.
If the current could be affect the display, the example 2 should be has the same issue but it does not. You can see the example 2 video, there is the same animation and the screen is working great. The difference between example 1 and 2 is that one drawStr() is fixed string, another is a global variable.

I also use setPrintPos and print, it didn't better... =(

thanks!

Maybe you should start from a working example. Try modifing the code until it does not work any more.

I have never seen such a behavior before. I have no idea what is wrong here. :frowning:

Oliver

Thank you! I have bought NHD OLED, I think it can work fine with the great u8glib. :slight_smile:

olikraus:
Maybe you should start from a working example. Try modifing the code until it does not work any more.

I have never seen such a behavior before. I have no idea what is wrong here. :frowning:

Oliver