user25614: I am trying to port a simple project I have working in an Arduino UNO to a NodeMCU but I am stuck as I am using the analog gpio to receive the input from some buttons, I am always getting always low values (between 0 and 5) while in the working arduino sketch I get values from 0 to 1023.
I have tried deactivating the wifi while trying to retrieve the values, but I got no luck trying that, as I have read that sometimes the NodeMCU A0 gpio malfunctions when the wifi is not sleeping.
I am setting up the gpio in the setup method like this:
void setup(void){
    pinMode(sensorPin, INPUT_PULLUP);  
    ...

And my sensorPin variable is declared in the beginning of the sketch
int sensorPin = A0; 

Any ideas why when I read the value in the NodeMCU I don't get the same behaviour as in an Arduino board?

user25614: As stated by Majenko in the comments, I thought that all MCUs analog gpios had a pullup resistor built in, so I have been able to solve the problem using an external pullup, in this case connecting a 10K resistor like in the diagram: 
 . 
Special thanks to Majenko for his time and patience. Cheers! 

25614: <p>I am trying to port a simple project I have working in an Arduino UNO to a NodeMCU but I am stuck as I am using the analog gpio to receive the input from some buttons, I am always getting always low values (between 0 and 5) while in the working arduino sketch I get values from 0 to 1023.</p>

<p>I have tried deactivating the wifi while trying to retrieve the values, but I got no luck trying that, as I have read that sometimes the NodeMCU A0 gpio malfunctions when the wifi is not sleeping.</p>

<p>I am setting up the gpio in the setup method like this:</p>

<pre><code>void setup(void){
    pinMode(sensorPin, INPUT_PULLUP);  
    ...
</code></pre>

<p>And my sensorPin variable is declared in the beginning of the sketch</p>

<pre><code>int sensorPin = A0; 
</code></pre>

<p>Any ideas why when I read the value in the NodeMCU I don't get the same behaviour as in an Arduino board?</p>
 25614: <p>As stated by Majenko in the comments, I thought that all MCUs analog gpios had a pullup resistor built in, so I have been able to solve the problem using an external pullup, in this case connecting a 10K resistor like in the diagram: </p>

<p><a href="https://i.stack.imgur.com/djw9d.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/djw9d.jpg" alt="enter image description here"></a> . </p>

<p>Special thanks to Majenko for his time and patience. Cheers! </p>
