OVF when doing calculations

Hi, guys! I'm pretty new in here. In fact, i've recently started programming for school classes. So, here is my problem. I need to program a CO2 sensor and when I compile my code, the value given is OVF. I've searched it and I know that it means overflow, but I don't know why it gives me that. Can someone help me? I'm sure I've messed up with the code and I need someone to check it for me because I don't have idea.


#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F,16,2); // definimos el lcd

float a = 5.2735;
float b = -0.3503;
int RL = 1000;
float Ro = 5932.22;
float VALOR_SENSOR; //value readen by sensor
float VOLTAJE_SALIDA;
float Rs_1;
float ppm;

void setup() {
  Serial.begin(9600);
  lcd.init(); //inicializamos nuestro LCD
  lcd.backlight(); //se activa la iluminaciĆ³n
}

void loop() {
  VALOR_SENSOR=analogRead(A0);
  VOLTAJE_SALIDA=((VALOR_SENSOR*5)/1023);
  Rs_1=((5-VALOR_SENSOR)/VALOR_SENSOR)*RL;
  ppm=pow(((Rs/Ro)/a),1/b);
  lcd.setCursor(0,0);
  lcd.print("Valor: ");
  lcd.print(ppm);
  lcd.print(" ppm");
  lcd.println();
  delay(5000);
}

Also, I need to do this calculation:
image
And I written it in the code as:

ppm= pow(((Rs/Ro)/a),1/b);

I don't know if that is right, can someone help me?

Please edit your post to add code tags, and post the error message, in quotes. The Arduino IDE gives the option to copy error message.

ppm=pow(((Rs/Ro)/a),1/b);

Where is Rs defined?

The value for Rs is not defined. Perhaps it should be Rs_1?

G
Beaten to the punch.

Done! I edited already :slight_smile: Oops, I didn't see that. Rs is Rs_1 in my code. I have no error messages, Arduino lets me compile with no problem but no value appears apart from OVF. I've just finished changing it but now, instead of OVF, it shows NAN.

I didn't see it, thank you! But as I said, instead of OVF, it shows NAN when I compile.

The program cannot be compiled without fatal errors if Rs is undefined, let alone loaded and run.

Try again.

If VALOR_SENSOR is greater than 5 then Rs_1 will be negative so -1/b will be taking a root of a negative number and so ppm will be imaginary.
G