Arduino Uno seperate Tasks

Hi everybody,

I'm working on my project witch must send datas to a web server using wifi shield.

I have two tasks to do:

  • the first one is to send a GET request every 5 minutes
    -the second tasks must listen if a client is connected and make an action if a client is connected to my arduino server.

This two tasks works separately, I have two differnt codes, I'm trying to put together.
What I'd like is, in the loop, to reserve 30 sec for the first task and then 4min and 30 sec for the second task.
I can't use delay() because it can do nothing else at the same time.

Thank you a lot!

I thought about doing for loops for having the second task 100x more than the first. For example:

loop()
{
  for(i=0;i<100;i++)
 {
     delay1--;
     if (delay1==0)
     {
         delay1=100;  
         send datas....
     }
     
  }
 for (i=0; i<10000;i++)
 {
     listen for incomming event
 }  

}

Is this a good way to solve my problem? I tried but it doesn't work...

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

Look up the 'blink without delay' example in the IDE and look up Finite State Machine.