Hi there, working on another project (previous one is shelved for a while)
I’ve got my mega rigged up so it can save data to an SD card (prompts for input of filename in mm/dd/yy on LCD to be put in by keypad) asks for a time to run for (also prompted by keypad and displays on screen) and a number of thermistors to read (max 16 obv due to thats all the analog ins on a mega)
then it starts to read the therms, math them, output on screen 1 of the thermistor readings (i can set this to a specific one or it cycles through the different therms) runs down until the timer hits zero, then flashes colors with the backlight of the LCD.
Now, this all works. surprisingly well might I add. Problem is, that to do the math on the thermistors to get the temp readings, I’v got this for loop in it,
all the vars are declared and all, most all of them are floats ebcause the math ahs some hardcore decimals in it
for( I = 0; I < thermistoramount; I++) // sets up the for loop to start at value I and increment by 1
// every tick until I no longer is <2
{
test[I] = analogRead(pin[I]);
voltage = test[I] * 0.0048828;
Rtherm = (voltage * 10000) / (5 - voltage);
ratio = Rtherm/R25;
test[I] = voltage;
/////
//lots more math down here
/////
}
thats but a fraction of the math happening, theres a section to account for the nonlinearity of the thermistor readings, and another section so itll output data in kelvin celcius and farenheight (you can choose which you want to read/write to SD too)
And I’ve hit the sheer problem of the math portion of the code is taking long enough its throwing off the timer (I used basically the blink without delay code to get it to work). Depending on the number of thermistors there are with 1, theres almost no notice ability (because then it only runs through he for loop once per tick) but when running 16 of them it starts to be slow, about 10 mins slow per hour.
Now what I’m wondering, is there any way to make a more efficient timer. Or do i need to gut the math in such a way (get everything into long int math, that might be faster then 16 floats running around)
Ahead of time TY for the help