tcoh = analogRead(2); Serial.println (""); Serial.print ("Time clock overhead door = "); Serial.print (tcoh);
d1ocount = d1ocount++;
Erratic behaviour and a big sketch are both hints that you may have out-of-memory problems. I haven't looked at your source but I suggest that if you're using the String class you stop doing that. Also add up the number of bytes of global data and the number of bytes of literal values (especially string constants) throughout your code and subtract from the amount of RAM on your Arduino (e.g. 2KB for a UNO) and see whether you're anywhere near close to running out. If this doesn't make it obvious, look on the playground for a code fragment to measure the free memory and make your sketch log that at startup.
The issue is not the size of your source file, it's how much RAM your sketch is consuming at runtime. Judicious use of the F macro, as suggested above, should avoid the necessity to buy a Mega.
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16