microrobotics icon

LCD 16x2 Character Display 3.3V I2C

microrobotics | PRO | 05/11/23 07:49:00 AM UTC | 0 ⭐ | 3366 👁️ | Never ⏰ | []
Arduino |

540 B

|

None

|

0 👍

/

0 👎

/*
To interface a 16x2 LCD with ESP32, you can use the LiquidCrystal_I2C library. Here's a simple example:
 
Assuming the following connection:
 
SDA => GPIO21
SCL => GPIO22
*/
 
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
 
// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
 
void setup()
{
  lcd.begin(16,2); // initialize the lcd 
 
  lcd.backlight();
  lcd.setCursor(0,0); // go to the top left corner
  lcd.print("Hello, world!");
  lcd.setCursor(0,1); // go to the 2nd line
 
 

Comments