NodeMCU and analogRead(A0)
Posted: Sun Jul 16, 2017 5:17 am
OK, I'm a noob. This is said. And also not native english speaker.
I have a NodeMCU 0.9 that I program using the Arduino IDE. I try to read a voltage using the ADC, but it doesn't work.
I connect a potentiometer between 3V3, GND and the A0 pin, and use this program:
All I get on the console is 65536, whatever the value of the resistor. What's going wrong?
Thanks for your help.
I have a NodeMCU 0.9 that I program using the Arduino IDE. I try to read a voltage using the ADC, but it doesn't work.
I connect a potentiometer between 3V3, GND and the A0 pin, and use this program:
Code: Select all
ADC_MODE(ADC_VCC);
int val = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
val = analogRead(A0);
Serial.println(val);
}
All I get on the console is 65536, whatever the value of the resistor. What's going wrong?
Thanks for your help.