DSCF0622

PROJECT 1 – “Hello World” ON LCD

PROJECT 1

“Hello World” ON LCD

Back to Project 0                                                                                                       Go to Project 2

Arduino LCD Keypad Shield or navigation shield which come with 6 momentary push button for menu navigation and also a 2×16 LCD. It only required to plug and use with Arduino main board and there no soldering or fly-wiring are required.

———————————————————————————————————————————————————-

COMPONENT NEEDED

———————————————————————————————————————————————————-

ARDUINO LCD-KEYPAD SHIELD

———————————————————————————————————————————————————-

CONNECTION

———————————————————————————————————————————————————-
For the LCD Keypad Shield, it use total of 6-pins to control the LCD display which is pin-4,5,6,7,8,9. For LCD data, it use pin-4,5,6,7, while for the RS and Enable pin, it use pin-8 and 9. The Arduino-LCD Keypad Shield are only required to plug into the Arduino main board and there was no soldering are required such as shown in figure below.

Arduino LCD 2×16 Schematic

Arduino Keypad Schematic

———————————————————————————————————————————————————-

ADDITIONAL INFORMATION

———————————————————————————————————————————————————-
The Arduino-LCD Keypad Shield are operate in 4-bits mode. To ease user, Arduino Team have prepared the <LiquidCrystal.h> file which we only require to modified and change the pin using only. For more information please check the Arduino LCD keypad Shield schematic.

For more example of the Arduino LCD Keypad coding, please refer to this webpage.

———————————————————————————————————————————————————-

CODE OVERVIEW

———————————————————————————————————————————————————-

#include <LiquidCrystal.h>
Include the LiquidCrystal header file which is already prepared inside the Arduino libraries.

LiquidCrystal.lcd(8, 9, 4, 5, 6, 7);
In here, we set the pin using for LCD 4-bit mode by refer to Arduino Liquid Crystal webpage which is LiquidCrystal(rs, enable, d4, d5, d6, d7).

Int analogPin = A0;
Define the A0 as analogPin while assign a space to it as an integer.

Int adc_key_val[5] = {30 , 150 , 360, 535, 760};
Define the adc_key_val from 0 to 4 which contain the number inside the bracket. E.g: adc_key_val[1] = 150;

char msgs [5][15] = {“Right Key OK”,
                            “Up Key OK      ”,
                            “Down Key OK ”,
                            “Left Key OK    ”,
                            “Select Key OK”};
Define the each ASCII value in char which content of total 5 string and there was 15 ASCII value for each string.

lcd.begin(16,2);
Specified the dimension (width and height)of the LCD display.

lcd.clear();
Clear the screen of the LCD display.

lcd.print(“ CYTRON TECH.”);
Send the ASCII code to the LCD display according to the text enter.

lcd.setCursor(0,1);
Position the LCD cursor,that is set the location at which subsequent text written to the LCD will be displayed.

adc_key_in = analogRead(analogPin);
Read the value from the specified pin (analogPin) and store the value in the adc_key_in.

adc_key_in = get_key(adc_key_in);
Send the adc_key_in value to the get_key subroutine.

lcd.print(msgs[adc_key_in]);
Print the text on the msgs[] to the LCD display according to the adc_key_in.

for(k = 0; k < NUM_KEYS; k++)
Loop from k=0 to k=4.

If(input < adc_key_val[k])
Check of the value from the analogPin are less than adc_key_val[k].

return k;
Replace the original k value with the number of k from 0 to 4.

If (k >= NUM_KEYS)
k = -1;
If detected the k value are large, assign k = -1.

Back to Project 0                                                                                                        Go to Project 2

———————————————————————————————————————————————————-

ATTACHMENT

1. P1 User Manual.pdf
2. Project_1_code.zip

Buy

, , ,

Related Post

Jpeg

How to Make your Line Following Robot Faster?

Control Mobile Robot through WiFi with ESP-WiFi Shield (Arduino + Andriod)

Arduino + 2A motor + Encoder

Arduino + 2A Motor Shield + Encoder Motor

ESPresoo Lite V2 Package

Bringing IoT to Everyone – Collaboration of ASEAN Makers

Leave a Reply

Your email address will not be published. Required fields are marked *