Monday, April 4, 2016

NodeMCU to read analog input, A0.

Last post introduced "Serial Plotter in Arduino IDE" with Arduino Uno example to read analog input and println to Serial Port, to display on Arduino Software's Serial Plotter. The example can direct re-compile and run target NodeMCU/ESP8266.

remark: Fritzing part of NodeMCU can be found HERE.

Example code, same as in last post.
const int AnalogIn  = A0;

int readingIn = 0;

void setup() {

void loop() {
  readingIn = analogRead(AnalogIn);


  1. How can I transmit analog reading from pin A0 of Nodemcu to a webpage? Thank you in advance!

    1. after connecting to a client
      we can print it using client.println(readingIn)

  2. That depends on what page you want to write to. For my project, i'm sendind data from an ESP8266 to a web page hosted on my Raspberry Pi using MQTT protocol. I don't know if this will suit your needs, but you can search a little bit about MQTT an how it works :)