Reading sensors and acting on their input

I am building a greenhouse that is going to be totally controlled by my arduino mega. At the moment I have two DHT11 sensors a light sensor and two voltage sensors. One for battery ad one for solar. Then I have servos to open vents and intake and extralegal fans controlled by relays. All this data is displayed on an LCD aswell as sent via xbee to a second arduino that is displaying the info.

On to the problem. I would like the arduino to always be updatin the LCD with the most uptodate info. But. If it gets into a a 5 min delay that allows the battery to recoup the display dose not update. How can I create a separate loop that is always running?

Without seeing any code, we can only make guesses, but I would guess your '5 minute delay' is accomplished using delay().

delay() basically means 'Do nothing at all for the specified period of time'

If you want to do other things during that time, then do not use delay().

There is a sample that shows how to handle timing various activities without using delay(). It's called Blink without delay. Take a look at it, try to apply it to your code. If you have issues, come back, post your code, explain your issues, and you'll get some useful help.

Unless you get REALLY fancy, and it may not even be a good idea, even if you know how... every Arduino program has one main loop "outside" of everything else.

One way to "manage" what the Arduino is doing is to set up something like this... and there are probably "typos" in it... look for the underlying logic, but you'll have to fight with the semicolons, etc, yourself.

Not shown are the subroutines you would have to do to explain to the Arduino what it is suppose to do when you call for DoItA, DoItB, etc.

The following arranges for "DoItA" to happen quite often, others to happen less often, and DoItRarely just once in a while.

Yes, there is a "case" structure, if you want to learn about that.

void setup(); { int iLoopControl=0; }

void loop(); { if (iLoopControl==0) {DoItA}; if (iLoopControl==1) {DoItB}; if (iLoopControl==2) {DoItA}; if (iLoopControl==3) {DoItC}; if (iLoopControl==4) {DoItA}; if (iLoopControl==5) {DoItB}; if (iLoopControl==6) {DoItA}; if (iLoopControl==7) {DoItC}; if (iLoopControl==8) {DoItA}; if (iLoopControl==9) {DoItB}; if (iLoopControl==10) {DoItA}; if (iLoopControl==11) {DoItC}; if (iLoopControl==12) {DoItRarely};

inc(iLoopControl); if (iLoopControl>12){iLoopControl=0};