Corrupt HD44780 display

I’m having a strange problem with my lcd display where the demo code works perfectly but my code results in a corrupt screen with the same settings. This demo code works correctly

// include the library code:
#include <LiquidCrystal.h>

// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 12, en = 11, d4 = 10, d5 = 4, d6 = 1, d7 = 0;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis() / 1000);
}

but my code results in garbage on the display. Would the pins I’m using in my code be conflicting with the serial monitor, hence the problem? The serial monitor is working ok, I’m using a Nano v3.1 if it’s relevant.

frednet:
This demo code works correctly
...
but my code results in garbage on the display. Would the pins I'm using in my code be conflicting with the serial monitor, hence the problem? The serial monitor is working ok, I'm using a Nano v3.1 if it's relevant.

Well, unless we see your code that is not working, it appears we will never know why! :astonished:

Will we?

d6 =d6 = 1, d7 = 0; 1, d7 = 0

Even though you are not using Serial those pins are still connected to the USB to serial adapter chip. That may interfere with the ability to pull one or both of those pins low. Try different pins for d6 and d7.