Im using esp32, voltage divider and monochrome OLED.
Since the monochrome OLED failed to detect I2C address, I proceed with u8g2 lib. However, the display is not stable. Sometimes its shows, sometime it won't and sometimes it give random trash display. I don't know which part of my programming is wrong. Is it something usually happen when using u8g2 lib?
You've told very little about what display you are using, so we'll have to do some guessing.
It's more likely for this to be a hardware problem than it is a problem with your code.
Quite a while ago, some forum members had similar problems.
I did too, and found a thread about that.
After a while, i found a cause and a "solution" for my display, so have a look here (click !) to see about that.
It may help you out, but no guarantees.