Diffrent value between virtual pin and value direct get from analog pin

i try both virtual pin and analog pin in the widget display value but both value not the same below is the code

void MQ6()
{
float sensorValue;
sensorValue = analogRead(A0);
Blynk.virtualWrite(V7, sensorValue);
}

AnalogRead will provide an integer, not a float. That may add to the confusion?

The results you get will depend on the type of board you’re using.

With a 5v Arduino, an analogue input value of 5v will give a reading of 1023, therefore, each step between 0 and 1023 represents 0.004883 volts.

With an ESP8266, the maximum measurable input voltage on A0 is 1v, which will result in an output of 1023. As a result, each step between 0 and 1023 represents 0.00097656 volts.

Pete.

i am using arduino uno with 5v output. My virtual pin look like get less than 1024 value and my analog pin get exactly 1024 value because when i mapping the value using blynk app it was weird. For example i get 74 from both analog pin and virtual pin in the beginning then i do mapping value to 0-100 by using blynk app analog pin get 7 but using virtual pin mapping it show 50 means that my virtual pin is 0-148 only. is this something bug with the mapping using blynk app ?

If by mapping you mean that little squiggly symbol between the MIN and MAX… then possibly buggy… I have never gotten it to work properly and always use the Arduino map() command in my code instead.

I’m sorry, I don’t make any sense of what you’ve written here.
It would help if you applied a known/measured voltage (between 1 and 5 volts) to your analogue pin (don’t forget that if you’re doing this with an external power source then the ground of the external source and the Arduino need to be connected together).

You should then tell us:

  • Measured voltage at the Analogue pin
  • Result of Analogue Read of that pin
  • Result displayed in Blynk with a 0-1023 range and no data mapping
  • Result displayed in Blynk with 0-1023 range and data mapping enabled.

Pete.

Thx for reply i also do like that map() inside the code i though the app can map automatically

i solve my problem already thx pete