Skip to content

Instantly share code, notes, and snippets.

@elktros
Created February 27, 2021 08:40
Show Gist options
  • Save elktros/339b9fc3ae5047717c3561b241587e77 to your computer and use it in GitHub Desktop.
Save elktros/339b9fc3ae5047717c3561b241587e77 to your computer and use it in GitHub Desktop.
Displaying ADC Value on I2C LCD using ESP32.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
const int potPin = 15;
// variable for storing the potentiometer value
int potValue = 0;
LiquidCrystal_I2C lcd(0x3F, 16, 2);
void setup()
{
lcd.init();
lcd.backlight();
lcd.setCursor(0,0);
lcd.print(" I2C LCD with ");
lcd.setCursor(0,1);
lcd.print(" ESP32 DevKit ");
delay(2000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("ADC Value =");
}
void loop()
{
potValue = analogRead(potPin);
lcd.setCursor(12,0);
lcd.print(potValue);
delay(1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment