Arduino Mega and 1602A LCD keypad shield just a blue screen

First off i'm new to this. This is my first time so bare with me if I've done something stupidly obvious. I've just received my Arduino mega and 1602A LCD keypad shield today and I thought i'd have a play around and see how it works by following a few examples to learn the basics of the programming language.

Step 1. I connected the shield to the Arduino mega carefully lining up the pins
Step 2. i installed arduino IDE on my PC.
Step 3. I connected the arduino to the PC with the USB cable
Step 4. I copied and pasted some example codes see below,
Step 5. I verified /complied, without any errors and then uploaded,

The screen lights up blue but thats it, i tried adjusting the screw on the potentiometer for the screen contrast carefully turned it 10 turns clockwise, nothing. Have i missed something out?

The 2 sample codes i tried were:

#include <LiquidCrystal.h>

LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

int adc_key_in;
void setup() {
lcd.begin(16, 2);
}

void loop() {
adc_key_in = analogRead(0);
lcd.setCursor(0, 0);
lcd.print("A0:");
lcd.setCursor(0, 1);
lcd.print(adc_key_in);
}

and

/*
Arduino 2x16 LCD - Detect Buttons
modified on 18 Feb 2019
by Saeed Hosseini @ Electropeak

*/
#include <LiquidCrystal.h>
//LCD pin to Arduino
const int pin_RS = 8;
const int pin_EN = 9;
const int pin_d4 = 4;
const int pin_d5 = 5;
const int pin_d6 = 6;
const int pin_d7 = 7;
const int pin_BL = 10;
LiquidCrystal lcd( pin_RS, pin_EN, pin_d4, pin_d5, pin_d6, pin_d7);
void setup() {
lcd.begin(16, 2);
lcd.setCursor(0,0);
lcd.print("Electropeak.com");
lcd.setCursor(0,1);
lcd.print("Press Key:");
}
void loop() {
int x;
x = analogRead (0);
lcd.setCursor(10,1);
if (x < 60) {
lcd.print ("Right ");
}
else if (x < 200) {
lcd.print ("Up ");
}
else if (x < 400){
lcd.print ("Down ");
}
else if (x < 600){
lcd.print ("Left ");
}
else if (x < 800){
LCD.print ("Select");
}
}

Do i need to install some library's for the LCD keypad shield?

Any help much appreciated

My mistake i connected it to the wrong pins easy mistake for a beginner. Lucky no damage is done and it appears to work fine now. I have run a couple of the example codes and it's all good.

Glad to hear it. Although the idea of a shield is that you can't connect it incorrectly, so not sure what you did there.

Next time you post, please read the forum guide in the sticky post first. Your post above breaks forum "rules".

Since you have posted more than a couple of times, I will explain the "rules". :grinning:


OK, first things first.

You need to go and read the forum instructions so that you can go back and modify your original posts (not re-post them) - using the "More -> Modify" option below the right hand corner of your post - to mark up your code as such using the "</>" icon in the posting window. Just highlight each section of code (or output if you need to post that) from the IDE and click the icon.

In fact, the IDE itself has a "copy for forum" link to put these markings on a highlighted block for you so you then just paste it here in a posting window. But even before doing that, don't forget to use the "Auto-Format" (Ctrl-T) option first to make it easy to read. If you do not post it as "code" it can often be quite garbled and is always more difficult to read due to the font.

It is inappropriate to attach it as a ".ino" file unless it is clearly too long to include in the post proper. People can usually see the mistakes directly and do not want to have to actually load it in their own IDE. And even that would also assume they are using a PC and have the IDE running on that PC.

Also tidy up your blank space. Do use blank lines, but only single blanks between complete functional blocks.