After my quick Hello World app, I became a bit more adventurous and decided to interface with the LCD screen that was part of the basic kit from Simple Labs (see this post for more details). Fortunately, arduino has a library called LiquidCrystal to interface with LCD displays that are driven by Hitachi HD44780 compatible drivers. All you have to do is add a #include <LiquidCrystal.h> in your code to start using the library.
But before going into the coding part, I had to first make the proper connections from the LCD display to the arduino board. I looked up the datasheet for my LCD display, but found a much simpler connection diagram over at http://www.arduino.cc/en/Tutorial/LiquidCrystal. I did not make the exact connections like in the diagram. This is what I did
LCD Arduino
PIN 1 (GND) GND
PIN 2 (Vcc) +5V
PIN 3 (Contrast adjustment) Voltage divider (see below)
PIN 4 (Register select) Digital PIN 13
PIN 5 (R/W signal) GND
PIN 6 (Enable signal) Digital PIN 12
PIN 7 (Data bus line)
PIN 8 (Data bus line)
PIN 9 (Data bus line)
PIN 10 (Data bus line)
PIN 11 (Data bus line) Digital PIN 11
PIN 12 (Data bus line) Digital PIN 10
Pins 7, 8, 9, 10, 15 and 16 are not connected to the arduino board. Pin 3 was supposed to be connected to a 10K pot, but since I did not have a pot, I had to do a voltage divider circuit. I tried out 1K, 10K divider circuit, with output of the 1K ohm resistor connected to pin 3. This gave me the correct contrast! Although the LCD display has 8 data lines it can be driven with only 4 lines with a lower refresh rate and the arduino library can communicate over the 4 lines. Now that the connections are done, back to programming. Here is the code
#include <LiquidCrystal.h>
LiquidCrystal lcd(13, 12, 11, 10, 9, 8);
void setup() {
Very simple app that displays "hello" on the LCD screen.
If you want the backlight of the LCD screen to turn on, connect pin 15 to +5V with a limiting resistor and pin 16 to ground.
But before going into the coding part, I had to first make the proper connections from the LCD display to the arduino board. I looked up the datasheet for my LCD display, but found a much simpler connection diagram over at http://www.arduino.cc/en/Tutorial/LiquidCrystal. I did not make the exact connections like in the diagram. This is what I did
LCD Arduino
PIN 1 (GND) GND
PIN 2 (Vcc) +5V
PIN 3 (Contrast adjustment) Voltage divider (see below)
PIN 4 (Register select) Digital PIN 13
PIN 5 (R/W signal) GND
PIN 6 (Enable signal) Digital PIN 12
PIN 7 (Data bus line)
PIN 8 (Data bus line)
PIN 9 (Data bus line)
PIN 10 (Data bus line)
PIN 11 (Data bus line) Digital PIN 11
PIN 12 (Data bus line) Digital PIN 10
PIN 13 (Data bus line) Digital PIN 9
PIN 14 (Data bus line) Digital PIN 8
PIN 15
PIN 16
Pins 7, 8, 9, 10, 15 and 16 are not connected to the arduino board. Pin 3 was supposed to be connected to a 10K pot, but since I did not have a pot, I had to do a voltage divider circuit. I tried out 1K, 10K divider circuit, with output of the 1K ohm resistor connected to pin 3. This gave me the correct contrast! Although the LCD display has 8 data lines it can be driven with only 4 lines with a lower refresh rate and the arduino library can communicate over the 4 lines. Now that the connections are done, back to programming. Here is the code
#include <LiquidCrystal.h>
LiquidCrystal lcd(13, 12, 11, 10, 9, 8);
void setup() {
// Setup LCD's number of columns and rows
lcd.begin(16, 2);
// Print a message to LCD
lcd.print("hello");
}
// a function which executes again and again
void loop() {
}
If you want the backlight of the LCD screen to turn on, connect pin 15 to +5V with a limiting resistor and pin 16 to ground.
Comments
You'll need to enter your personal information in 춘천 출장샵 order to 평택 출장샵 access the hotel. The process is quite simple. Once you're done, 강원도 출장샵 navigate to 과천 출장샵 the homepage of the website. Click on 충청남도 출장마사지