Page 1 of 1

keypad,LCD and arduino nano

PostPosted: Wed May 23, 2012 1:13 am
by hariana
hi can u help me.I faced a problem here....i make one project about sms walkie-talkie......i want make hardware using keypad, LCD and arduino nano for send message.......keypad can type message and send to LCD........can u help me design of LCD,KEYPAD and arduino nano v3.0 and coding......... my LCD doesn't display anything on screen and keypad (keypad 3x4 matrix 12-KEY Membrane Switch Keypad AVR 51)not function......I attached my coding, hope anyone can advice and help me.


#include <LiquidCrystal.h>
#include <Keypad.h>
const byte ROWS = 4; //Four rows//
const byte COLS = 3; //Three columns//
char keys[ROWS][COLS] =
{
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'#','0','*'}
};
// Define the Keymap//
byte rowPins[ROWS] = { 13, 10, 9, 8 };// Connect keypad ROW1, ROW2, ROW3 and ROW4 to these Arduino pins//
byte colPins[COLS] = { 7, 6, A5 }; // Connect keypad COL1, COL2 and COL3 to these Arduino pins//
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );//end of creating the Keypad//
LiquidCrystal lcd(12, NULL, 11, 5, 4, 3, 2); //create the lcd variable

void setup() {
lcd.clear(); //clear the LCD during setup
lcd.begin(8,2); //define the columns (8) and rows (2)
}

void loop() {
char key = keypad.getKey();
lcd.clear();
delay(1000);
if (key != NO_KEY)
{
lcd.clear();
lcd.home();
lcd.print("A");
delay(1000);

}
lcd.clear();
lcd.home();
lcd.print("ABC");
delay(1000);
lcd.clear(); //clear LCD, since we are still on 2nd line...
lcd.home(); //set the cursor the top left
}

Re: keypad,LCD and arduino nano

PostPosted: Wed May 23, 2012 10:10 am
by yonghui
hmm..

better u debug one by one.
may start with connnection lcd and display someting successfuly 1st.

the lcd is 4bit mode or 8bit mode connected?


regards,
yh

Re: keypad,LCD and arduino nano

PostPosted: Wed May 23, 2012 12:16 pm
by shahrul
Try coding for LCD only before add another coding. Maybe hardware wrong.

Re: keypad,LCD and arduino nano

PostPosted: Thu May 24, 2012 12:01 am
by hariana
LCD can display when i use coding 'hello word" but after i use keypeypad not function.........this my circuit ......can u help me