Skip to content

Instantly share code, notes, and snippets.

@elktros
Last active February 8, 2021 07:48
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/e817ddb3a8aba8a3da80c1555d73efb8 to your computer and use it in GitHub Desktop.
Save elktros/e817ddb3a8aba8a3da80c1555d73efb8 to your computer and use it in GitHub Desktop.
Code for ESP8266 ADC Output printing over Serial Monitor.
#define analogPin A0 /* ESP8266 Analog Pin ADC0 = A0 */
int adcValue = 0; /* Variable to store Output of ADC */
void setup()
{
Serial.begin(115200); /* Initialize serial communication at 115200 */
}
void loop()
{
adcValue = analogRead(analogPin); /* Read the Analog Input value */
/* Print the output in the Serial Monitor */
Serial.print("ADC Value = ");
Serial.println(adcValue);
delay(1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment