{"id":2390,"date":"2025-07-05T18:26:38","date_gmt":"2025-07-05T18:26:38","guid":{"rendered":"https:\/\/learnbydoing.dev\/?p=2390"},"modified":"2026-01-10T22:30:21","modified_gmt":"2026-01-10T22:30:21","slug":"how-to-use-i2c-lcd-with-arduino","status":"publish","type":"post","link":"https:\/\/learnbydoing.dev\/how-to-use-i2c-lcd-with-arduino\/","title":{"rendered":"How to use i2c lcd with Arduino"},"content":{"rendered":"<div data-elementor-type=\"wp-post\" data-elementor-id=\"2390\" class=\"elementor elementor-2390\" data-elementor-post-type=\"post\">\n\t\t\t\t<div class=\"elementor-element elementor-element-e28ab35 e-flex e-con-boxed e-con e-parent\" data-id=\"e28ab35\" data-element_type=\"container\" data-e-type=\"container\" id=\"content\" data-settings=\"{&quot;background_background&quot;:&quot;classic&quot;}\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t<div class=\"elementor-element elementor-element-62ab6e3 e-con-full e-flex e-con e-child\" data-id=\"62ab6e3\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-62ab203 elementor-align-center elementor-widget elementor-widget-post-info\" data-id=\"62ab203\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"post-info.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<ul class=\"elementor-inline-items elementor-icon-list-items elementor-post-info\">\n\t\t\t\t\t\t\t\t<li class=\"elementor-icon-list-item elementor-repeater-item-2c98363 elementor-inline-item\" itemprop=\"about\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-icon-list-text elementor-post-info__item elementor-post-info__item--type-terms\">\n\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-post-info__terms-list\">\n\t\t\t\t<span class=\"elementor-post-info__terms-list-item\">Arduino<\/span>, <span class=\"elementor-post-info__terms-list-item\">Electronics<\/span>, <span class=\"elementor-post-info__terms-list-item\">Tutoriales<\/span>\t\t\t\t<\/span>\n\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t<\/li>\n\t\t\t\t<\/ul>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-0650e10 e-con-full e-flex e-con e-child\" data-id=\"0650e10\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-ac19582 elementor-view-default elementor-widget elementor-widget-icon\" data-id=\"ac19582\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"icon.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-icon-wrapper\">\n\t\t\t<div class=\"elementor-icon\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"75\" height=\"75\" viewbox=\"0 0 75 75\" fill=\"none\"><path d=\"M74.9999 75H13.1889V73.0002H71.5859L0.460938 1.87521L1.87515 0.460999L73.0001 71.586V13.1889H74.9999V75Z\" fill=\"white\"><\/path><\/svg>\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-47aa245d e-flex e-con-boxed e-con e-parent\" data-id=\"47aa245d\" data-element_type=\"container\" data-e-type=\"container\" data-settings=\"{&quot;background_background&quot;:&quot;classic&quot;}\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-5711048 elementor-widget elementor-widget-image\" data-id=\"5711048\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img fetchpriority=\"high\" decoding=\"async\" width=\"800\" height=\"450\" src=\"https:\/\/learnbydoing.dev\/wp-content\/uploads\/2025\/07\/I2C-LCD-1024x576.webp\" class=\"attachment-large size-large wp-image-2497\" alt=\"\" srcset=\"https:\/\/learnbydoing.dev\/wp-content\/uploads\/2025\/07\/I2C-LCD-1024x576.webp 1024w, https:\/\/learnbydoing.dev\/wp-content\/uploads\/2025\/07\/I2C-LCD-300x169.webp 300w, https:\/\/learnbydoing.dev\/wp-content\/uploads\/2025\/07\/I2C-LCD-768x432.webp 768w, https:\/\/learnbydoing.dev\/wp-content\/uploads\/2025\/07\/I2C-LCD-1536x864.webp 1536w, https:\/\/learnbydoing.dev\/wp-content\/uploads\/2025\/07\/I2C-LCD-18x10.webp 18w, https:\/\/learnbydoing.dev\/wp-content\/uploads\/2025\/07\/I2C-LCD.webp 1920w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-261c3d8 elementor-widget elementor-widget-text-editor\" data-id=\"261c3d8\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p><span class=\"TextRun SCXW175257011 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW175257011 BCX0\">In this tutorial, <\/span><span class=\"NormalTextRun SCXW175257011 BCX0\">you&#8217;ll<\/span><span class=\"NormalTextRun SCXW175257011 BCX0\"> learn how to use a 16&#215;2 LCD display with an I2C interface using the <\/span><span class=\"NormalTextRun SpellingErrorV2Themed SCXW175257011 BCX0\">Adafruit_LiquidCrystal<\/span><span class=\"NormalTextRun SCXW175257011 BCX0\"> library. The code example shows how to display a counter that increments every second and blinks the backlight to create a visual effect.<\/span><\/span><span class=\"EOP SCXW175257011 BCX0\" data-ccp-props=\"{}\">\u00a0<\/span><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-12b1fcd elementor-widget elementor-widget-text-editor\" data-id=\"12b1fcd\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h3 data-start=\"227\" data-end=\"258\"><strong>What is an I2C LCD Display?<\/strong><\/h3><p data-start=\"260\" data-end=\"574\">When working with LCD screens and microcontrollers like Arduino, a common challenge is the number of pins required for communication. A standard 16&#215;2 LCD display usually needs <strong data-start=\"436\" data-end=\"463\">at least 6 digital pins<\/strong> to function properly, which can be quite limiting\u2014especially when your project includes many other components.<\/p><p data-start=\"576\" data-end=\"765\">That&#8217;s where the <strong data-start=\"593\" data-end=\"604\">I2C LCD<\/strong> comes in. I2C stands for <strong data-start=\"630\" data-end=\"658\">Inter-Integrated Circuit<\/strong>, and it\u2019s a communication protocol that allows multiple devices to communicate using just <strong data-start=\"749\" data-end=\"762\">two wires<\/strong>:<\/p><ol><li data-start=\"768\" data-end=\"796\"><strong data-start=\"768\" data-end=\"794\">SDA (Serial Data Line)<br \/><\/strong><\/li><li data-start=\"768\" data-end=\"796\"><strong data-start=\"799\" data-end=\"826\">SCL (Serial Clock Line)<br \/><br \/><\/strong><\/li><\/ol><p data-start=\"828\" data-end=\"1111\">An I2C LCD display is essentially a regular LCD screen that comes with a small <strong data-start=\"907\" data-end=\"930\">I2C backpack module<\/strong> soldered on the back. This backpack handles all the parallel-to-serial conversion, so you only need two pins (plus power and ground) from your Arduino to control the entire screen.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-324d52d elementor-widget elementor-widget-text-editor\" data-id=\"324d52d\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h3 data-start=\"1857\" data-end=\"1885\"><span style=\"vertical-align: inherit;\"><span style=\"vertical-align: inherit;\"><span style=\"vertical-align: inherit;\"><span style=\"vertical-align: inherit;\">\u00a0<strong>\ud83d\udcdd Required components<\/strong><\/span><\/span><\/span><\/span><\/h3><ol><li><span data-contrast=\"auto\">Arduino Uno<\/span><\/li><li>16&#215;2 LCD with I2C backpack<\/li><li>Jumper wires<\/li><li>Breadboard (optional)<\/li><\/ol>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a236fe0 elementor-widget elementor-widget-text-editor\" data-id=\"a236fe0\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h3 aria-level=\"2\"><b><span data-contrast=\"none\"><span style=\"vertical-align: inherit;\"><span style=\"vertical-align: inherit;\">Step 1: wiring the electronics<\/span><\/span><\/span><\/b><\/h3><ol><li><span data-contrast=\"auto\"> Connect GND of the LCD to GND on Arduino.<br \/><br \/><\/span><\/li><li><span data-contrast=\"auto\"> Connect VCC of the LCD to 5V on Arduino.<br \/><br \/><\/span><\/li><li><span data-contrast=\"auto\"> Connect SDA on the LCD to A4 on Arduino.<br \/><br \/><\/span><\/li><li><span data-contrast=\"auto\"> Connect SCL on the LCD to A5 on Arduino.<\/span><\/li><\/ol>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ee10903 elementor-widget elementor-widget-image\" data-id=\"ee10903\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"800\" height=\"450\" src=\"https:\/\/learnbydoing.dev\/wp-content\/uploads\/2025\/07\/I2C-LCD-1-1024x576.webp\" class=\"attachment-large size-large wp-image-2504\" alt=\"\" srcset=\"https:\/\/learnbydoing.dev\/wp-content\/uploads\/2025\/07\/I2C-LCD-1-1024x576.webp 1024w, https:\/\/learnbydoing.dev\/wp-content\/uploads\/2025\/07\/I2C-LCD-1-300x169.webp 300w, https:\/\/learnbydoing.dev\/wp-content\/uploads\/2025\/07\/I2C-LCD-1-768x432.webp 768w, https:\/\/learnbydoing.dev\/wp-content\/uploads\/2025\/07\/I2C-LCD-1-1536x864.webp 1536w, https:\/\/learnbydoing.dev\/wp-content\/uploads\/2025\/07\/I2C-LCD-1-18x10.webp 18w, https:\/\/learnbydoing.dev\/wp-content\/uploads\/2025\/07\/I2C-LCD-1.webp 1920w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-e04c0ca elementor-widget elementor-widget-text-editor\" data-id=\"e04c0ca\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h3 aria-level=\"2\">\ud83d\udda5\ufe0f<b><span data-contrast=\"none\">Step 2: Writing the Code<\/span><\/b><\/h3><p id=\"tw-target-text\" class=\"tw-data-text tw-text-large tw-ta\" dir=\"ltr\" data-placeholder=\"Traduzione\" data-ved=\"2ahUKEwjIo-uooqSOAxWf0QIHHfG9BBYQ3ewLegQICRAV\" aria-label=\"Testo tradotto: Below you will find the complete code to use the humidity sensor:\"><span class=\"Y2IQFc\" lang=\"en\">Below you will find the complete code to use the humidity sensor:<\/span><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-1ba2cef elementor-widget elementor-widget-code-highlight\" data-id=\"1ba2cef\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-tomorrow copy-to-clipboard\">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-cpp line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-cpp\">\n\t\t\t\t\t<xmp>Upload this sketch to display a message: \r\n\r\n \r\n#include <Wire.h> \r\n#include <LiquidCrystal_I2C.h> \r\n \r\nLiquidCrystal_I2C lcd(0x27, 16, 2);  \/\/ Set I2C address 0x27, 16 columns and 2 rows \r\n \r\nvoid setup() { \r\n  lcd.init();                       \/\/ Initialize the LCD \r\n  lcd.backlight();                  \/\/ Turn on the backlight \r\n  lcd.setCursor(0, 0);              \/\/ First column, first row \r\n  lcd.print(\"Hello, World!\");       \/\/ Print message on first row \r\n  lcd.setCursor(0, 1);              \/\/ First column, second row \r\n  lcd.print(\"I2C LCD Demo\");        \/\/ Print message on second row \r\n} \r\n \r\nvoid loop() { \r\n  \/\/ Nothing needed here \r\n} \r\n<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7a888ec elementor-widget elementor-widget-text-editor\" data-id=\"7a888ec\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h3><b>\ud83d\udd0e\u00a0<\/b><b>Breaking down the Code<\/b><\/h3><p>Let\u2019s review the code section by section:<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-01f8801 elementor-widget elementor-widget-code-highlight\" data-id=\"01f8801\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-tomorrow copy-to-clipboard\">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-cpp line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-cpp\">\n\t\t\t\t\t<xmp>#include <Adafruit_LiquidCrystal.h>\r\n<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-16783b7 elementor-widget elementor-widget-text-editor\" data-id=\"16783b7\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<ul><li><p data-start=\"436\" data-end=\"533\">Includes the <strong data-start=\"452\" data-end=\"478\">Adafruit_LiquidCrystal<\/strong> library that allows you to control the I2C LCD easily.<\/p><\/li><li><p data-start=\"436\" data-end=\"533\">Make sure to install this library via the <strong data-start=\"582\" data-end=\"609\">Arduino Library Manager<\/strong>.<\/p><\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7242351 elementor-widget elementor-widget-code-highlight\" data-id=\"7242351\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-tomorrow copy-to-clipboard\">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-cpp line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-cpp\">\n\t\t\t\t\t<xmp>int seconds = 0;\r\n<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0887672 elementor-widget elementor-widget-text-editor\" data-id=\"0887672\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<ul><li data-start=\"1016\" data-end=\"1071\">Declares a global variable <code data-start=\"675\" data-end=\"684\">seconds<\/code> to store the number of seconds that have passed.<\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-988ae1f elementor-widget elementor-widget-code-highlight\" data-id=\"988ae1f\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-tomorrow copy-to-clipboard\">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-cpp line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-cpp\">\n\t\t\t\t\t<xmp>Adafruit_LiquidCrystal lcd_1(0);\r\n<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-455a2f8 elementor-widget elementor-widget-text-editor\" data-id=\"455a2f8\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<ul><li data-start=\"1536\" data-end=\"1595\"><p data-start=\"784\" data-end=\"823\">Creates an LCD object named <code data-start=\"815\" data-end=\"822\">lcd_1<\/code>.<\/p><\/li><li data-start=\"1536\" data-end=\"1595\"><p data-start=\"784\" data-end=\"823\">The argument <code data-start=\"840\" data-end=\"843\">0<\/code> is a <strong data-start=\"849\" data-end=\"865\">reference ID<\/strong> (not the I2C address). In some versions, you might use <code data-start=\"921\" data-end=\"934\">lcd_1(0x27)<\/code> or <code data-start=\"938\" data-end=\"951\">lcd_1(0x3F)<\/code> depending on your I2C backpack.<\/p><\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6503883 elementor-widget elementor-widget-code-highlight\" data-id=\"6503883\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-tomorrow copy-to-clipboard\">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-cpp line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-cpp\">\n\t\t\t\t\t<xmp>void setup() {\r\n  lcd_1.begin(16, 2);           \/\/ Initialize 16x2 LCD\r\n  lcd_1.print(\"hello world\");   \/\/ Print on first row\r\n}\r\n<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b51cf90 elementor-widget elementor-widget-text-editor\" data-id=\"b51cf90\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<ul data-start=\"1503\" data-end=\"1581\"><li data-start=\"1503\" data-end=\"1532\"><ul><li data-start=\"1155\" data-end=\"1230\"><p data-start=\"1157\" data-end=\"1230\"><code data-start=\"1157\" data-end=\"1178\">lcd_1.begin(16, 2);<\/code> initializes the LCD with <strong data-start=\"1204\" data-end=\"1229\">16 columns and 2 rows<\/strong>.<\/p><\/li><li data-start=\"1231\" data-end=\"1346\"><p data-start=\"1233\" data-end=\"1346\"><code data-start=\"1233\" data-end=\"1262\">lcd_1.print(\"hello world\");<\/code> prints the message starting from the <strong data-start=\"1300\" data-end=\"1312\">top-left<\/strong> corner (default cursor position).<\/p><\/li><\/ul><\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6f27b82 elementor-widget elementor-widget-code-highlight\" data-id=\"6f27b82\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-tomorrow copy-to-clipboard\">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-cpp line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-cpp\">\n\t\t\t\t\t<xmp>lcd_1.setCursor(0, 1);\r\nlcd_1.print(seconds);\r\n<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9b822a2 elementor-widget elementor-widget-text-editor\" data-id=\"9b822a2\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<ul data-start=\"1503\" data-end=\"1581\"><li data-start=\"1503\" data-end=\"1532\"><ul><li data-start=\"1435\" data-end=\"1540\"><p data-start=\"1437\" data-end=\"1540\">These lines <strong data-start=\"1865\" data-end=\"1889\">toggle the backlight<\/strong> on and off every second to create a blinking effect.<\/p><\/li><\/ul><\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-52f7e5d elementor-widget elementor-widget-code-highlight\" data-id=\"52f7e5d\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-tomorrow copy-to-clipboard\">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-cpp line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-cpp\">\n\t\t\t\t\t<xmp>seconds += 1;<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-1b5b0c4 elementor-widget elementor-widget-text-editor\" data-id=\"1b5b0c4\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<ul><li data-start=\"1830\" data-end=\"1890\"><p data-start=\"1567\" data-end=\"1605\">Increments the counter by 1 each time the loop runs (once per second).<\/p><\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c92ae44 elementor-widget elementor-widget-text-editor\" data-id=\"c92ae44\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h3><b style=\"color: inherit; font-family: inherit; font-size: 2rem; text-wrap-mode: initial;\"><span data-contrast=\"none\">\ud83d\udee0\ufe0f<\/span><\/b><b><span data-contrast=\"none\">Step 3: Troubleshooting<\/span><\/b><\/h3><p><strong>Nothing appears on the LCD:<\/strong><\/p><ul><li><span data-contrast=\"auto\">Verify the I2C address with an I2C scanner sketch.<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/li><li><span data-contrast=\"auto\">Check wiring (SDA to A4, SCL to A5).<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/li><\/ul><p>\u00a0<\/p><p><strong>Text is garbled:\u00a0<\/strong><\/p><ul><li><span data-contrast=\"auto\">Adjust potentiometer on I2C backpack to set contrast.<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you&#8217;ll learn how to use a 16&#215;2 LCD display with an I2C interface using the Adafruit_LiquidCrystal library. The code example shows how to display a counter that increments every second and blinks the backlight to create a visual effect.\u00a0 What is an I2C LCD Display? When working with LCD screens and microcontrollers [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":2497,"comment_status":"closed","ping_status":"open","sticky":false,"template":"elementor_header_footer","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[68,69,43],"tags":[261,59,84,264,83,160,263,82,179,262,66,270,164,165,267,269,266,162,265,76,64,268],"class_list":["post-2390","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino","category-electronics","category-tutorials","tag-261","tag-arduino","tag-c","tag-comunication","tag-cpp","tag-display","tag-i2c","tag-ide","tag-lbd","tag-lcd","tag-learn-by-doing","tag-learning","tag-liquidcrystal","tag-liquidcrystal-h","tag-pins","tag-project","tag-scl","tag-screen","tag-sda","tag-step-by-step","tag-tutorial","tag-uno"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to use i2c lcd with Arduino - Learn by Doing!<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/learnbydoing.dev\/es\/how-to-use-i2c-lcd-with-arduino\/\" \/>\n<meta property=\"og:locale\" content=\"es_ES\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Installing ROS 2 Jazzy on Ubuntu 24.04: Step-by-Step Tutorial\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, you&#8217;ll learn how to use a 16&#215;2 LCD display with an I2C interface using the Adafruit_LiquidCrystal library. The code example shows how to display a counter that increments every second and blinks the backlight to create a visual effect.\u00a0 What is an I2C LCD Display? When working with LCD screens and microcontrollers [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/learnbydoing.dev\/es\/how-to-use-i2c-lcd-with-arduino\/\" \/>\n<meta property=\"og:site_name\" content=\"Learn by Doing!\" \/>\n<meta property=\"article:published_time\" content=\"2025-07-05T18:26:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-01-10T22:30:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/learnbydoing.dev\/wp-content\/uploads\/2025\/06\/Progetto-senza-titolo-14.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Escrito por\" \/>\n\t<meta name=\"twitter:data1\" content=\"\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tiempo de lectura\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/learnbydoing.dev\\\/how-to-use-i2c-lcd-with-arduino\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/learnbydoing.dev\\\/how-to-use-i2c-lcd-with-arduino\\\/\"},\"author\":{\"name\":\"\",\"@id\":\"\"},\"headline\":\"How to use i2c lcd with Arduino\",\"datePublished\":\"2025-07-05T18:26:38+00:00\",\"dateModified\":\"2026-01-10T22:30:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/learnbydoing.dev\\\/how-to-use-i2c-lcd-with-arduino\\\/\"},\"wordCount\":428,\"publisher\":{\"@id\":\"https:\\\/\\\/learnbydoing.dev\\\/es\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/learnbydoing.dev\\\/how-to-use-i2c-lcd-with-arduino\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/learnbydoing.dev\\\/wp-content\\\/uploads\\\/2025\\\/07\\\/I2C-LCD.webp\",\"keywords\":[\"1602\",\"Arduino\",\"c++\",\"comunication\",\"cpp\",\"display\",\"i2c\",\"ide\",\"lbd\",\"lcd\",\"learn by doing\",\"learning\",\"liquidcrystal\",\"liquidcrystal.h\",\"pins\",\"project\",\"scl\",\"screen\",\"sda\",\"step by step\",\"tutorial\",\"uno\"],\"articleSection\":[\"Arduino\",\"Electronics\",\"Tutorials\"],\"inLanguage\":\"es\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/learnbydoing.dev\\\/how-to-use-i2c-lcd-with-arduino\\\/\",\"url\":\"https:\\\/\\\/learnbydoing.dev\\\/how-to-use-i2c-lcd-with-arduino\\\/\",\"name\":\"How to use i2c lcd with Arduino - Learn by Doing!\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/learnbydoing.dev\\\/es\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/learnbydoing.dev\\\/how-to-use-i2c-lcd-with-arduino\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/learnbydoing.dev\\\/how-to-use-i2c-lcd-with-arduino\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/learnbydoing.dev\\\/wp-content\\\/uploads\\\/2025\\\/07\\\/I2C-LCD.webp\",\"datePublished\":\"2025-07-05T18:26:38+00:00\",\"dateModified\":\"2026-01-10T22:30:21+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/learnbydoing.dev\\\/how-to-use-i2c-lcd-with-arduino\\\/#breadcrumb\"},\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/learnbydoing.dev\\\/how-to-use-i2c-lcd-with-arduino\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/learnbydoing.dev\\\/how-to-use-i2c-lcd-with-arduino\\\/#primaryimage\",\"url\":\"https:\\\/\\\/learnbydoing.dev\\\/wp-content\\\/uploads\\\/2025\\\/07\\\/I2C-LCD.webp\",\"contentUrl\":\"https:\\\/\\\/learnbydoing.dev\\\/wp-content\\\/uploads\\\/2025\\\/07\\\/I2C-LCD.webp\",\"width\":1920,\"height\":1080},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/learnbydoing.dev\\\/how-to-use-i2c-lcd-with-arduino\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/learnbydoing.dev\\\/es\\\/learn-by-doing-es\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to use i2c lcd with Arduino\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/learnbydoing.dev\\\/es\\\/#website\",\"url\":\"https:\\\/\\\/learnbydoing.dev\\\/es\\\/\",\"name\":\"Learn by Doing!\",\"description\":\"Learn Robotics the fun way\",\"publisher\":{\"@id\":\"https:\\\/\\\/learnbydoing.dev\\\/es\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/learnbydoing.dev\\\/es\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"es\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/learnbydoing.dev\\\/es\\\/#organization\",\"name\":\"Learn by Doing!\",\"url\":\"https:\\\/\\\/learnbydoing.dev\\\/es\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/learnbydoing.dev\\\/es\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/learnbydoing.dev\\\/wp-content\\\/uploads\\\/2025\\\/06\\\/cropped-cropped-cropped-Progetto-senza-titolo-6-1.png\",\"contentUrl\":\"https:\\\/\\\/learnbydoing.dev\\\/wp-content\\\/uploads\\\/2025\\\/06\\\/cropped-cropped-cropped-Progetto-senza-titolo-6-1.png\",\"width\":512,\"height\":512,\"caption\":\"Learn by Doing!\"},\"image\":{\"@id\":\"https:\\\/\\\/learnbydoing.dev\\\/es\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/antonio-brandi-512166bb\\\/\"]},{\"@type\":\"Person\",\"@id\":\"\",\"url\":\"https:\\\/\\\/learnbydoing.dev\\\/es\\\/author\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to use i2c lcd with Arduino - Learn by Doing!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/learnbydoing.dev\/es\/how-to-use-i2c-lcd-with-arduino\/","og_locale":"es_ES","og_type":"article","og_title":"Installing ROS 2 Jazzy on Ubuntu 24.04: Step-by-Step Tutorial","og_description":"In this tutorial, you&#8217;ll learn how to use a 16&#215;2 LCD display with an I2C interface using the Adafruit_LiquidCrystal library. The code example shows how to display a counter that increments every second and blinks the backlight to create a visual effect.\u00a0 What is an I2C LCD Display? When working with LCD screens and microcontrollers [&hellip;]","og_url":"https:\/\/learnbydoing.dev\/es\/how-to-use-i2c-lcd-with-arduino\/","og_site_name":"Learn by Doing!","article_published_time":"2025-07-05T18:26:38+00:00","article_modified_time":"2026-01-10T22:30:21+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/learnbydoing.dev\/wp-content\/uploads\/2025\/06\/Progetto-senza-titolo-14.webp","type":"image\/webp"}],"twitter_card":"summary_large_image","twitter_misc":{"Escrito por":"","Tiempo de lectura":"4 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/learnbydoing.dev\/how-to-use-i2c-lcd-with-arduino\/#article","isPartOf":{"@id":"https:\/\/learnbydoing.dev\/how-to-use-i2c-lcd-with-arduino\/"},"author":{"name":"","@id":""},"headline":"How to use i2c lcd with Arduino","datePublished":"2025-07-05T18:26:38+00:00","dateModified":"2026-01-10T22:30:21+00:00","mainEntityOfPage":{"@id":"https:\/\/learnbydoing.dev\/how-to-use-i2c-lcd-with-arduino\/"},"wordCount":428,"publisher":{"@id":"https:\/\/learnbydoing.dev\/es\/#organization"},"image":{"@id":"https:\/\/learnbydoing.dev\/how-to-use-i2c-lcd-with-arduino\/#primaryimage"},"thumbnailUrl":"https:\/\/learnbydoing.dev\/wp-content\/uploads\/2025\/07\/I2C-LCD.webp","keywords":["1602","Arduino","c++","comunication","cpp","display","i2c","ide","lbd","lcd","learn by doing","learning","liquidcrystal","liquidcrystal.h","pins","project","scl","screen","sda","step by step","tutorial","uno"],"articleSection":["Arduino","Electronics","Tutorials"],"inLanguage":"es"},{"@type":"WebPage","@id":"https:\/\/learnbydoing.dev\/how-to-use-i2c-lcd-with-arduino\/","url":"https:\/\/learnbydoing.dev\/how-to-use-i2c-lcd-with-arduino\/","name":"How to use i2c lcd with Arduino - Learn by Doing!","isPartOf":{"@id":"https:\/\/learnbydoing.dev\/es\/#website"},"primaryImageOfPage":{"@id":"https:\/\/learnbydoing.dev\/how-to-use-i2c-lcd-with-arduino\/#primaryimage"},"image":{"@id":"https:\/\/learnbydoing.dev\/how-to-use-i2c-lcd-with-arduino\/#primaryimage"},"thumbnailUrl":"https:\/\/learnbydoing.dev\/wp-content\/uploads\/2025\/07\/I2C-LCD.webp","datePublished":"2025-07-05T18:26:38+00:00","dateModified":"2026-01-10T22:30:21+00:00","breadcrumb":{"@id":"https:\/\/learnbydoing.dev\/how-to-use-i2c-lcd-with-arduino\/#breadcrumb"},"inLanguage":"es","potentialAction":[{"@type":"ReadAction","target":["https:\/\/learnbydoing.dev\/how-to-use-i2c-lcd-with-arduino\/"]}]},{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/learnbydoing.dev\/how-to-use-i2c-lcd-with-arduino\/#primaryimage","url":"https:\/\/learnbydoing.dev\/wp-content\/uploads\/2025\/07\/I2C-LCD.webp","contentUrl":"https:\/\/learnbydoing.dev\/wp-content\/uploads\/2025\/07\/I2C-LCD.webp","width":1920,"height":1080},{"@type":"BreadcrumbList","@id":"https:\/\/learnbydoing.dev\/how-to-use-i2c-lcd-with-arduino\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/learnbydoing.dev\/es\/learn-by-doing-es\/"},{"@type":"ListItem","position":2,"name":"How to use i2c lcd with Arduino"}]},{"@type":"WebSite","@id":"https:\/\/learnbydoing.dev\/es\/#website","url":"https:\/\/learnbydoing.dev\/es\/","name":"Learn by Doing!","description":"Learn Robotics the fun way","publisher":{"@id":"https:\/\/learnbydoing.dev\/es\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/learnbydoing.dev\/es\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"es"},{"@type":"Organization","@id":"https:\/\/learnbydoing.dev\/es\/#organization","name":"Learn by Doing!","url":"https:\/\/learnbydoing.dev\/es\/","logo":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/learnbydoing.dev\/es\/#\/schema\/logo\/image\/","url":"https:\/\/learnbydoing.dev\/wp-content\/uploads\/2025\/06\/cropped-cropped-cropped-Progetto-senza-titolo-6-1.png","contentUrl":"https:\/\/learnbydoing.dev\/wp-content\/uploads\/2025\/06\/cropped-cropped-cropped-Progetto-senza-titolo-6-1.png","width":512,"height":512,"caption":"Learn by Doing!"},"image":{"@id":"https:\/\/learnbydoing.dev\/es\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.linkedin.com\/in\/antonio-brandi-512166bb\/"]},{"@type":"Person","@id":"","url":"https:\/\/learnbydoing.dev\/es\/author\/"}]}},"_links":{"self":[{"href":"https:\/\/learnbydoing.dev\/es\/wp-json\/wp\/v2\/posts\/2390","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/learnbydoing.dev\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/learnbydoing.dev\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/learnbydoing.dev\/es\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/learnbydoing.dev\/es\/wp-json\/wp\/v2\/comments?post=2390"}],"version-history":[{"count":31,"href":"https:\/\/learnbydoing.dev\/es\/wp-json\/wp\/v2\/posts\/2390\/revisions"}],"predecessor-version":[{"id":5577,"href":"https:\/\/learnbydoing.dev\/es\/wp-json\/wp\/v2\/posts\/2390\/revisions\/5577"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/learnbydoing.dev\/es\/wp-json\/wp\/v2\/media\/2497"}],"wp:attachment":[{"href":"https:\/\/learnbydoing.dev\/es\/wp-json\/wp\/v2\/media?parent=2390"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/learnbydoing.dev\/es\/wp-json\/wp\/v2\/categories?post=2390"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/learnbydoing.dev\/es\/wp-json\/wp\/v2\/tags?post=2390"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}