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() {
  Serial.begin(9600);
}

void loop() {
  readingIn = analogRead(AnalogIn);
  Serial.println(readingIn);
}


No comments:

Post a Comment