I have a simple arithmetic question I can't seem to figure out. I am reading data from a sensor (OPT101) that is connected to A0, and I would like to take that value and enter it into my equation ( (391/880)x + (1/880) ). However, no matter what the input is, the output is always coming out to zero.
This is the code:
int pinRead0 = analogRead(inPin0); float pVolt0 = pinRead0 / 1023.0 * 5.0; Serial.print(pVolt0, 4); float lightintensity = pVolt0 * (391/880) + (1/880); Serial.print(lightintensity,4);
What did I do wrong?
Thank you in advance