Analog pin of NodeMcu esp

hello …

my sensor is connected to the analog pin of the my nodemcu esp8266 how to read the data as voltage for example of i want to print on blynk i want to display 0-1024 ? what commad with what number should i write?

int sensor = analogRead(A0); //get value from analog pin 0 (NodeMCU only has one analog pin) and store it as sensor
Blynk.virtualWrite(V1, sensor); //pass value stored in sensor to BLYNK virtual pin 1

On BLYNK App, use a Value Display (or whatever widget you would like to use to display the value) and link it to Virtual pin 1.

Be sure to include all necessary libraries and such.

there is not gpio pin number only A , then why we use with dht22 the gpio numbers !

You said “connected to the analog pin”, and “how to read the data”

So that is what I provided.

do i have to write this also
pinMode(A0, INPUT);

I never have.

I think analog pins can only be used as inputs so no declaration is needed (I could be wrong, so don’t quote me on this).

Also, the NodeMCUs I have used in the past had a voltage divider circuit built into the board. In my case it was approx. 3.3v = 1023. You may want to confirm though before putting that high of a voltage on it. Maybe start with .8V and see what the output is, if it is low then most likely it has the voltage divider .

Hope this helps.

@m.alm you have a lot to learn about “pins”.

Analogue pins are input only and have no associated pinMode.

@Toro_Blanco 3.2V not 3.3V because like the WeMos, the manufacturer selected the “wrong” resistors.

yes because this is my first time using the esp and arduino ide :blush: