I see a bunch of mixing of types. I also don't see all the code. All variables that I use in calculations involving millis() I declare as unsigned long. Any constants I use in such calculations get UL at the end.
I see some division by 1000 to compare to runFor. If runFor was multiplied by 1000 then this division wouldn't be needed. I'm guessing runFor represents seconds. It would be better to have it represent millis().
That's some stuff I see but I'm just a hack. Some smarter than me guys will no doubt find some other issues.
If you anticipate that photosTaken * photoLength will be greater than the value of an int (32,767) then I think you need to tell the compiler to work with long values in the multiplication:
LarryD:
Use:
Serial.println(photosTaken); //what do you get?
Serial.println(photoLength; //what do you get?
//startOfNextPhoto = photosTaken * photoLength;
if I comment out this function it works... so what's the problem with this? the String(..) convertion?
I'd like to have a nickel for every time we've had to tell people that the String class has serious problems and should not be used until they are fixed.
Using the String class to avoid having three calls to lcd.print() is the height of laziness.
if I comment out this function it works... so what's the problem with this? the String(..) convertion?
I'd like to have a nickel for every time we've had to tell people that the String class has serious problems and should not be used until they are fixed.
Using the String class to avoid having three calls to lcd.print() is the height of laziness.
how should I know?
I wouldn't say the height of laziness but the height of having clean code which is as short as possible...
yes you're right the as short as possible is wrong! but you know what I mean and I didn't know that there is a risk of using String()
Anyways, thanks for helping