Send after minute data || send after ten minutes data

Hello. Thanks for coming!
I got two data variables:

data temp1
and data temp2

I want to send the data temp1 every minute, and THEN later of ten minutes, send the data variables to HTTP/POST
using the millis() function but I don't know if is correctly (I solve the post) only I need make the counter. I have the code:

void loop()
{
  unsigned long t_actual = 0;
  unsigned long t_corrido = millis();
  const long t_post = 600000;
  
  Cayenne.run(); //This is the function that sends data to the first post
  
  if(t_corrido == t_post) 
  {
    ToPostWStemp(); //This is the function that sends data to the second post
    t_actual = t_corrido; 
  }

  t_actual = 0; //Initialize the actual time from 0

}

I don't understand the point of this:

  t_actual = 0; //Initialize the actual time from 0

because this

  unsigned long t_actual = 0;

already set t_actual to zero. No harm, just redundant.

This:

  const long t_post = 600000;

should be

const unsigned long t_post = 600000;

but no harm, just forces the compiler to deal with it.

This

  if(t_corrido == t_post)

should be

  if (t_corrido >= t_post)

because there is no guarantee that millis() will ever return 600000. It probably will, but why take the chance?

Halo, vaj... I got a new code, and I guess is so much better than previous...

I tested, but the post doesn't send :S

void loop()
{

unsigned long t_cayenne = 0;
unsigned long t_post = 0;

    if (millis() - t_cayenne >= 60000)
    {
        // Do this every 60 seconds
        Cayenne.run();

        // Keep track of the last time this code ran, so we know
        // when to run it next time
        t_cayenne = millis();
    }
    if (millis() - t_post >= 600000)
    {
        ToPostWStemp();

        t_post = millis();
    }
}

Maclos:
Halo, vaj... I got a new code, and I guess is so much better than previous...

I tested, but the post doesn't send :S

void loop()

{

unsigned long t_cayenne = 0;
unsigned long t_post = 0;

if (millis() - t_cayenne >= 60000)
    {
… snip …

You are setting t_cayenne to zero at the start of every loop. Try this:

unsigned long t_cayenne = 0;
unsigned long t_post = 0;

void loop()
{
    if (millis() - t_cayenne >= 60000)
    {
… snip …

PaulMurrayCbr:
You are setting t_cayenne to zero at the start of every loop. Try this:

unsigned long t_cayenne = 0;

unsigned long t_post = 0;

void loop()
{
    if (millis() - t_cayenne >= 60000)
    {
… snip …

I'm not able to see the diferences... :confused: Uhh only change the const outside of loop??

t_cayenne is a variable, not a const.

The loop() function gets executed over and over again. Defining t_cayenne outside of a function (that is, declared globally) sets t_cayenne to zero once and allows it to preserve its value instead of repeatedly being reset to zero.

I love U guys, tomorro I'll test the code... I feel like stupid ._. THANKS FELLAS! I'll tell you how's going everything