Considering that the for
( pressao>1024
) condition is an error typing the code here, the pressure value is being printed as 0, since after reading the Arduino, you assign the value 0 to this variable in the for
loop, see:
pressao=analogRead(pressaoPin);
for (pressao=0; pressao>1024; pressao++) {}
Anyway, this loop seems unnecessary to me. If you just need to show the pressure value within the range [0.1023], just do this:
pressao=analogRead(pressaoPin);
Serial.println(pressao);
However, it is very common to want to transform the value [0.1023] into pressure, the code below is an example of how to do this (for a specific sensor):
//realiza a leitura na porta analica, o valor retornado já é o convertido pelo ADC
pressao=analogRead(pressaoPin);
//converte a leitura acima em tensão (considerando que a tensão de referencia são 5000 mv (ou 5 V).)
float tensao = (pressao * 5000.0) / 1023.0;
//transforma a tensão em pressão (kPa)
float p1 = ((((tensao - 800.0)*100000.0) / 3200.0) / 1000.0);
Note that this is for a specific sensor (code that I removed from an old project). The important thing here is to show how to transform a read value into an analog port into a value that makes sense for your problem (be it pressure, temperature, etc.) . You will need to read the datasheet of your sensor for the above conversion.
An excellent response over digital analog conversion ( ADC ).