Monday, August 24, 2015

Hello World with LCD Keypad Shield #Learn Arduino

I already found very useful code to display the character with the LCD.

//I've got nice code from the instructable (http://www.instructables.com/id/Arduino-LCD/)
//And I modified into my name
//The code:
#include <LiquidCrystal.h>
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
int readkey;
void setup() {
lcd.begin(16, 2);
lcd.print("Hello World!");
}
void loop() {
lcd.setCursor(0, 1); //start from coloumn 0 and row 1
lcd.print("My name is Hani");
readkey=analogRead(0);
if (readkey<50) {
lcd.clear();
lcd.print("Button Right");
}
else if(readkey<195) {
lcd.clear();
lcd.print("Button Up");
}
else if(readkey<380) {
lcd.clear();
lcd.print("Button Down");
}
else if(readkey<790) {
lcd.clear();
lcd.print("Button Left");
}
}



Happy share :)

3 comments:

Unknown said...

Ngoh, mantab, dah bisa basa apa aja sekarang jreng? :)

Hanifadinna said...

Hallo jreng Irma Rawit...masih beginner jreng :D, makasi ya jreng atas saran lo. Sangat membekas :)

Unknown said...

terus berkarya jreng ;)