{"id":808,"date":"2020-10-30T11:22:51","date_gmt":"2020-10-30T05:52:51","guid":{"rendered":"https:\/\/botuniverse.in\/?p=808"},"modified":"2022-01-04T08:05:38","modified_gmt":"2022-01-04T02:35:38","slug":"lcd-tutorial","status":"publish","type":"post","link":"https:\/\/botuniverse.in\/index.php\/2020\/10\/30\/lcd-tutorial\/","title":{"rendered":"How to use a LCD Part 1"},"content":{"rendered":"\n<p>The LCD Display is now very commonly used. To begin with we will be using the <a href=\"https:\/\/botuniverse.in\/index.php\/product\/lcd-display\/\">botuniverse LCD display.<\/a><\/p>\n\n\n\n<p>In the LCD Display, we have 16 columns &amp; 2 rows with each block having 5&#215;8 pixels. <\/p>\n\n\n\n<p class=\"has-text-color has-medium-font-size\" style=\"color:#263fbb\"><strong>Let&#8217;s Understand how the pins work:<\/strong><\/p>\n\n\n\n<ol><li>VSS \/ GND &#8211; This is the negative terminal &amp; has to be connected to the GND pin of UNO<\/li><li>VDD \/ VCC &#8211; This is the positive terminal &amp; has to be connected to the 5v pin of the UNO<\/li><li>VO &#8211; This is used to control the display contrast by varying its value<\/li><li>RS &#8211; This is also known as the register select pin. When it is low, it is understood that we are not sending data i.e. characters to it &amp; doing other actions like clearing the scroll or changing the cursor location. When it is high, we are sending characters to the LCD using the pins D0 &#8211; D7.<\/li><li>R\/W &#8211; Also known as the Read &amp; Write pin. We can control whether to read or to write by varying its value from 1 to 0 &amp; vice-versa<\/li><li>E  &#8211; Also known as the Enable pin. It works like a sync button, like ctrl+s<\/li><li>DB0 &#8211; DB7 &#8211; These pins go into D0 &#8211; D7. These pins are used to transit data to the LCD display.<\/li><li>A &#8211; Anode(+) Pin for the LCD Backlight<\/li><li>C &#8211; Cathode(-) Pin for the LCD Backlight<\/li><\/ol>\n\n\n\n<p><\/p>\n\n\n\n<p class=\"has-text-color has-medium-font-size\" style=\"color:#263fbb\"><strong>The two modes of the RS pin<\/strong><\/p>\n\n\n\n<ol><li>Command Mode &#8211; RS pin is low ; commands like set cursor , clear screen<\/li><li>Data Mode &#8211; RS pin is high ; data is being set through the pins.<\/li><\/ol>\n\n\n\n<p class=\"has-text-color has-medium-font-size\" style=\"color:#263fbb\"><strong>The two modes of the R\/W pin<\/strong><\/p>\n\n\n\n<ol><li>Read Mode &#8211;  R\/W is high<\/li><li>Write Mode &#8211; R\/W is low<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"774\" height=\"1024\" src=\"https:\/\/botuniverse.in\/wp-content\/uploads\/2020\/10\/image-4-774x1024.png\" alt=\"\" class=\"wp-image-857\"\/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/botuniverse.in\n#include &lt;LiquidCrystal.h&gt; \/\/ Including the library\nLiquidCrystal lcd = LiquidCrystal(2, 3, 4, 5, 6, 7); \/\/ Creating an LCD Object with the\n\/\/requred parameters (Pins)\n\nvoid setup() {\n  lcd.begin(16, 2); \/\/Specifying the LCD's number of columns &amp; rows\n}\nvoid loop() {\n  lcd.setCursor(2, 0); \/\/Setting the cursor on the third column &amp; first row.\n  \/\/Counting starts at one\n  lcd.print(\"Hello World!\"); \/\/Printing Hello World\n  lcd.setCursor(2, 1); \/\/ Setting the curson on the third column &amp; second row\n  lcd.print(\"LCD tutorial\"); \/\/Printing LCD tutorial\n}   <\/code><\/pre>\n\n\n\n<p>Attached is a video for help:<\/p>\n\n\n\n<figure><iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/dnQKCEcvsmU\" allowfullscreen=\"\"><\/iframe><\/figure>\n\n\n\n<h3><strong>lcd.clear()<\/strong><\/h3>\n\n\n\n<p>As the name suggests, this function does nothing more than just clear the display<\/p>\n\n\n\n<h3><strong>lcd.blink()<\/strong><\/h3>\n\n\n\n<p>As the name suggests, it will start blinking the location of the LCD cursor.<\/p>\n\n\n\n<h3><strong>lcd.noBlink()<\/strong><\/h3>\n\n\n\n<p>As the name suggests, it will stop the blinking LCD cursor.<\/p>\n\n\n\n<h3><strong>lcd.cursor()<\/strong><\/h3>\n\n\n\n<p>As the name suggests, it will display an undersocre (_) under the place where the cursor is going to write on.<\/p>\n\n\n\n<h3><strong>lcd.noCursor()<\/strong><\/h3>\n\n\n\n<p>As the name suggests it will hide the cursor<\/p>\n\n\n\n<p>Attached is another sample code to get you kickstarted<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;LiquidCrystal.h> \/\/Including the library\r\nLiquidCrystal lcd = LiquidCrystal(2,3,4,5,6,7); \/\/Making an object \r\n\r\nvoid setup(){\r\n    lcd.begin(16,2); \/\/ Determining the number of columns &amp; rows\r\n}\r\n\r\nvoid loop(){\r\n    lcd.print(\"Botuniverse\"); \/\/ Prints \"Botuniverse\" on lcd\r\n    delay(3000); \/\/ Makes the program wait for 3 seconds\r\n    lcd.cursor(); \/\/ Observe where the cursor is\r\n    delay(2000); \/\/ Makes the program wait for 2 seconds\r\n    lcd.setCursor(2,1); \/\/ Sets the location of the cursor. Observe where the cursor is\r\n    lcd.print(\"LCD Tutorial\") \/\/ Prints LCD Tutorial\r\n    delay(3000); \/\/ Makes the program wait for 3 seconds\r\n    lcd.clear(); \/\/See the LCD get completely empty\r\n    lcd.blink(); \/\/Observe which box is blinking\r\n    delay(4000); \/\/Makes the program wait for 4000 seconds\r\n    lcd.setCursor(7,1); \/\/Now see which box is blinking\r\n    delay(3000);\r\n    lcd.noBlink(); \/\/Closing the program *ALL the other lines\r\n    lcd.noCursor();\r\n    lcd.clear();\r\n}\r\n<\/code><\/pre>\n\n\n\n<p>I hope the code was self-explanatory &amp; so was the post, in the next part I will be covering custom characters. If you have any suggestions \/ ideas or doubts you can ask it in the comments section below or mail me at ideas@botuniverse.in .<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The LCD Display is now very commonly used. To begin with we will be using the botuniverse LCD display. In the LCD Display, we have 16 columns &amp; 2 rows with each block having 5&#215;8 pixels. Let&#8217;s Understand how the pins work: VSS \/ GND &#8211; This is the negative terminal &amp; has to be connected to the GND pin&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[34],"tags":[36,41,47,48,45,37,42,40,43,38,35,39,46,44],"_links":{"self":[{"href":"https:\/\/botuniverse.in\/index.php\/wp-json\/wp\/v2\/posts\/808"}],"collection":[{"href":"https:\/\/botuniverse.in\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/botuniverse.in\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/botuniverse.in\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/botuniverse.in\/index.php\/wp-json\/wp\/v2\/comments?post=808"}],"version-history":[{"count":28,"href":"https:\/\/botuniverse.in\/index.php\/wp-json\/wp\/v2\/posts\/808\/revisions"}],"predecessor-version":[{"id":957,"href":"https:\/\/botuniverse.in\/index.php\/wp-json\/wp\/v2\/posts\/808\/revisions\/957"}],"wp:attachment":[{"href":"https:\/\/botuniverse.in\/index.php\/wp-json\/wp\/v2\/media?parent=808"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/botuniverse.in\/index.php\/wp-json\/wp\/v2\/categories?post=808"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/botuniverse.in\/index.php\/wp-json\/wp\/v2\/tags?post=808"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}