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