It is often times useful to “un-tether” your arduino from your desktop PC, in order to have a system you can walk around with, and interact with the real world. One of the first steps in making this happen is to have some sort of display on your arduino project. In this lesson, we show you how to connect and program your project to be able to display simple messages on the LCD. This is a schematic diagram of how to connect the arduino to an LCD display. This will work for the LCD in the Elegoo Kit. Many LCD displays in fact share this same connection schematic.
The details are provided in the following video.
Below is the code we developed in the video.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #include <LiquidCrystal.h> int rs=7; int en=8; int d4=9; int d5=10; int d6=11; int d7=12; LiquidCrystal lcd(rs,en,d4,d5,d6,d7); void setup() { // put your setup code here, to run once: lcd.begin(16,2); } void loop() { lcd.setCursor(0,0); lcd.print("Watch me Count"); for (int j=1;j<=10;j=j+1){ lcd.setCursor(0,1); lcd.print(j); delay(500); } lcd.clear(); } |