4002A LCD display with Arduino
FunduinoPublished on
Zwei Zeilen mit je 40 Zeichen am Arduino
You need this
10 kOhm rotary potentiometer - carbon film, 6 mm shaft, up to 30 V
0,90 € *Item no. F23106608About the product — 10 kOhm rotary potentiometer - carbon film, 6 mm shaft, up to 30 V
Funduino UNO R3 Microcontroller - ATmega328P, 16 MHz, for Arduino
11,12 € *Item no. F23107480About the product — Funduino UNO R3 Microcontroller - ATmega328P, 16 MHz, for Arduino
Breadboard Cables Male-to-Male - 40 Pieces, 20 cm
1,74 € *Item no. FUN-1010558About the product — Breadboard Cables Male-to-Male - 40 Pieces, 20 cm
Breadboard cables male-female - 40 pieces, 20 cm
1,74 € *Item no. FUN-1010554About the product — Breadboard cables male-female - 40 pieces, 20 cm
All 4 parts together 15,50 € *
* All prices include statutory VAT, plus shipping costs.
The LCD 4002A
The wiring
1 / 2
The program
Two lines of text on the 4002A
```cpp
#include <LiquidCrystal.h> //Load the LCD library
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); //This line specifies which pins on the microcontroller board are used for the LCD (it's best not to change this initially).
void setup()
{
lcd.begin(40, 2); //In setup, specify how many characters and lines are used. Here: 16 characters in 2 lines.
}
void loop()
{
lcd.setCursor(0, 0); //Set the starting position for the display on the LCD. lcd.setCursor(0,0) means: first character on the first line.
lcd.print("www.funduino.de"); //The text "www.funduino.de" should appear here. The microcontroller board knows the lcd.setCursor command because the library was included.
lcd.setCursor(0, 1); //lcd.setCursor(0,1) means: first character on the second line.
lcd.print("Good luck"); //The text "Good luck!!!" should appear here.
}
```Alternating top and bottom
Alternating top and bottom
#include <LiquidCrystal.h> // LiquidCrystal
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup()
{
lcd.begin(40, 2);
}
void loop()
{
lcd.setCursor(0, 0);
lcd.print("Top"); //Start at the first character in the first line with the text "Top".
delay (2000); //Wait two seconds.
lcd.clear(); //Clear the display.
lcd.setCursor(5, 1);
lcd.print("bottom"); //Start again at the fifth character in the second line with the text "Bottom".
delay (2000); //Wait two seconds.
lcd.clear(); //Clear the display.
}Rate the instructions