Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@elktros
Created February 24, 2021 16:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elktros/a4b44a9961708dbeff833cf5c75a1016 to your computer and use it in GitHub Desktop.
Save elktros/a4b44a9961708dbeff833cf5c75a1016 to your computer and use it in GitHub Desktop.
Display ADC Value on I2C LCD using ESP8266 NodeMCU.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define analogPin A0 /* ESP8266 Analog Pin ADC0 = A0 */
int adcValue = 0; /* Variable to store Output of ADC */
LiquidCrystal_I2C lcd(0x3F, 16, 2);
void setup()
{
lcd.init();
lcd.backlight();
lcd.setCursor(0,0);
lcd.print("ADC Value = ");
}
void loop()
{
adcValue = analogRead(analogPin); /* Read the Analog Input value */
lcd.setCursor(0,0);
lcd.print("ADC Value = ");
lcd.setCursor(12, 0);
lcd.print(adcValue);
delay(1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment