LCD display not working properly + inconsistent results I have soldered the pins to my 20x4 LCD display. The soldering is not very good, but this is the best i can do. I have measured the resistance between each of the pins of the LCD with my multimeter to check if the pins are isolated. And they are! So the bad soldering is not the problem...

Last night, the display showed weird results and non-existent characters, all over the 20x4 display.
This morning, it showed only full blocks. But now it is showing only 2 of the 4 rows.
I think this is weird because i did not touch it in my sleep...

I should see the text 'Welcome', but i only see blocks now.

I dont have a potentiometer any more, so i used a for-loop with a PWM signal to check the contrast i need. This did work the last time for me.

I use the arduino MEGA.
Below you see my code, and photo's of my little project.

#include &lt;LiquidCrystal.h&gt;
LiquidCrystal lcd(9, 10, 48, 46, 44, 42);

const int contrastPin = 8;

void setup() {
  // put your setup code here, to run once:
  lcd.begin(20,4);
  pinMode(contrastPin,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:

  lcd.setCursor(0,0);
  lcd.print("Welcome");

  //LOOP TO CHECK TE CONTRAST
  for(int i = 0; i &lt;= 255; i++){
    analogWrite(contrastPin,i);
    delay(30);
  }
}
I re-soldered the pins. Also, I used a small resistor between my PWM signal and the VO port. Now it works perfectly.