[Noob] Problem with barometric sensor code

Hey guys I am trying to measure barometric pressure and altitude with a MPX4115A sensor using this code:


float T0, mmHg, P0, H0, z, R, g, voltage, pressure, altitude;
int led = 13;
int analog0 = 0;

void setup(){
pinMode(13, OUTPUT);
Serial.begin(9600);
}

void loop(){
digitalWrite(led, LOW);

T0=287.57;//Reference Temperature (K)
P0=104000.45;//Reference Pressure (Pa)
H0=45;//Reference altitude (m)
z=(-0.0065);//constant(K/m)
R=287.06;//constant (J/kg*K)
g=9.81;//gravitational acceleration (m/s^2)

analog0 = analogRead(A0);

voltage = ((float)analog0)*(5/1023);

pressure = ((22.222*voltage+10.556)*1000);

altitude = (T0/z)(pow(pressure/P0,(-zR)/g)-1)+H0;

Serial.print("Analog0: ");
Serial.println(analog0);
Serial.print("Pressure: ");
Serial.println(pressure);
Serial.print("Altitude: ");
Serial.println(altitude);

digitalWrite(led, HIGH);
delay(2000);
}


The pressure I'm getting is around 10556.00 Pascals, which is a tenth of the real pressure...
Can someone tell me what is wrong in this code or maybe show me an alternative code?
Thank you!

EDIT: Found the error :smiley:

This one: voltage = ((float)analog0)*(5/1023); // NOT GOOD!
force float with 5.0/1023.0