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:
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?