Why would this code not work with 16x2 lcd?

Why would this code not work with 16x2 lcd? I'm not an expert programmer neither a good English speaker so don't criticize me.

const int contrast = 11; const int RS = 10; const int RW = 9; const int enable = 13; const int DO = 12; const int D1 = 8; const int D2 = 7; const int D3 = 6; const int D4 = 5; const int D5 = 4; const int D6 = 3; const int D7 = 2;

void lcdwrite() { analogWrite(RS, 5); // makes RS pin HIGH which makes it write mode }

void lcdinst() { analogWrite(RS, 0); // makes RS pin LOW wich makes it instruction mode }

void lcdcontrast(int value) { analogWrite(contrast, value); // makes VO pin the value of int value

} void lcdmodewrite() { analogWrite(RW, 0); // makes RW pin low for write mode

}

void lcdenable() { digitalWrite(enable, HIGH); delay(1500); digitalWrite(enable, LOW);

}

void setup() { lcdcontrast(3); lcdwrite(); digitalWrite(12, HIGH); // code under should print F(binary: 1000110) delay(500); digitalWrite(8, LOW); delay(500); digitalWrite(7, LOW); delay(500); digitalWrite(6, LOW); delay(500); digitalWrite(5, LOW); delay(500); digitalWrite(4, HIGH); delay(500); digitalWrite(3, HIGH); delay(500); digitalWrite(3, LOW); lcdenable(); }

void loop() {

}

Because waggling pull-up resistors rarely achieves anything useful, however slowly you do it.

Please remember to use code tags when posting code

And please stop asking the same question over and over again. (Duplicates deleted)

don't criticize me

Don't post topics that aren't related to the website or forum in the "website & forum" section.

You forgot to set pinMode() on your pins.

You gave each of those pins names. It would be easier to understand your sketch if you used those names.

I highly recommend using the included LiquidCrystal library.

LiquidCrystal lcd(RS, EN, D0, D1, D2, D3, 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!");
}

I doubt that coolprogrammer is interested in using s library, possibly for learning.

@coolprogrammer, writing a value of 5 to a pwm pin does not make it it high.