In the past I wrote a header file Dewpnt_heatIndx.h and used it in arduino project.
namespace Dewpnt_heatIndx
{
// reference: http://en.wikipedia.org/wiki/Dew_point
double dewPointFast(double celsius, double humidity)
{
double a = 17.271;
double b = 237.7;
double temp = (a * celsius) / (b + celsius) + log(humidity * 0.01);
double Td = (b * temp) / (a - temp);
return Td;
}
double heatIndex(double tempF, double humidity)
{
double c1 = -42.38, c2 = 2.049, c3 = 10.14, c4 = -0.2248, c5 = -6.838e-3, c6 = -5.482e-2, c7 = 1.228e-3, c8 = 8.528e-4, c9 = -1.99e-6 ;
double T = tempF;
double R = humidity;
double A = (( c5 * T) + c2) * T + c1;
double B = ((c7 * T) + c4) * T + c3;
double C = ((c9 * T) + c8) * T + c6;
double rv = (C * R + B) * R + A;
return rv;
}
}
by including like this ::
#include "Dewpnt_heatIndx.h"
and then to use the subroutine in my ino file I called as shown below.
dP = (Dewpnt_heatIndx::dewPointFast(indorTempinC, indoorHumidity));
But today when I was using Builder on particle.io website, as soon as I hit enter after filling name of header file, it created a cpp file.
I have no prior experience of cpp, can anyone help me out with this please