# Pressure other than Float

Hi.
Can someone please suggest other conversion method that float?

My actual conversion.

`````` raw = analogRead(sensor1);
voltage = (float) raw / 1023.0 * 5.0;
pressure = (((float)analogRead(sensor1) / 1023.0 * 5.0) - 0.5) * 37.5;

dtostrf(pressure, 4, 0, buffer); // display pressure on glcd
glcd.drawstring(0, 2, buffer);
``````

Thank you

The voltage is not used at all ?

I don't know if 'raw', 'voltage', 'pressure' are float or integer or unsiged.

Does the glcd library have a function to print an integer ?

When you want to change a float calculation into an integer calculation, you have to know if the value can be negative (signed integer needed) and the maximum value (will it fit into a 16-bit or 32-bit integer).

In this case, I think that the pressure can not be negative, and the 0.5V is the offset.

To calculate the pressure from the raw value (let's forget the offset for now) = 5 / 1023 * 37.5
It means dividing the raw value by 5.45

That can be done by multiplying the raw value with 10 and divide it by 55.
Or mulitply by 2 and divide by 11

The raw value is maximum 1023 and that times 2 will fit into a normal integer.

``````int rawADC = analogRead(A1);

//substract 0.5V offset