Hi. I have a project ive been working on before. This is my very first arduino project. I am having a little trouble with my code and would like to see if anyone would have any interest in helping me out or give suggestions on my coding or wiring. Thank you.
I am sure that you will get a lot of help, but you need to be more specific - What is your program supposed to do? What is the problem? What have you already done to try and fix it?
My Project is a 3 box grow-box for any kind of plants. It is two small boxes and one large box. Each have their own DHT11 (Temp/Humidity) sensor, very basic moisture sensor made from nails and resistors, and am still debating the other sensor i should use but I have it labeled in my sketch as a light sensor. All three boxes are lit by a custom LED panel composed of 100+ SMD LED strips of red and blue and have a split light socket for normal incandescent of CFL bulbs. There is an exhaust system made of PC fans and the cooling system is made from an old wine cooler box And there is a pump and drain system all witch are controled by an 8 relay module connected to my arduino.
My problem is my timing and other little bugs with my serial menu. Since i don't have a RTC then the time has to be set manually and the lights wont turn on/off according to my timing throughout the day. My GOAL is to make this thing take care of itself for at least a week straight. watering when the soil is dry and turning off the lights on schedule and maybe in the future making it log all activity.
I am going to buy one soon but i don't think the problem is 'the time' but more of the 'timing code'. This is my first time programming anything and i'm sure my 'grammar' isn't the greatest . The arduino will function properly for around 8 hrs and then only 1 or 2 boxes work then just one after a day day and a half. The arduino IDE will let me compile it so i know it works, just not for very long.
timeCurrent=millis();
if(timeCurrent<*timeMark) { //Rollover detected
timeElapsed=(TIMECTL_MAXTICKS-*timeMark)+timeCurrent; //elapsed=all the ticks to overflow + all the ticks since overflow
...
if(timeElapsed>=timeInterval) {
You don't need to worry about overflow if you subtract. eg,
if(millis () - timeMark > timeInterval) {
You can save quite a bit of RAM by using the "F" macro for your string literals.
Serial.println(F("Diag Mode is Running "));
Serial.println(F("This will loop until other command recieved"));
Serial.println(F("15 Seconds to push another menu item"));