Help please , I need to put the time and a text in a array


i want keep 16 last events in arduino controller, make array this

code: [select]
char* eventos[16] ={"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16"};

i put values probe code.

then make routine show value that's ok
this show screen



all that's perfect when events occurs call routine

code: [select]
eventonuevo("protector");   // text show event light on light off or else

and routine make that
move previus values keep last 1 , put time of events

code: [select]

void eventonuevo( char* quepaso )
{
    char timeandevent[128];
    char* hora = reloj.time();   

/*his routine move older values ​​at beginning , put in last position last event occurred
*/
    (int bucle=1; bucle<16; bucle++)
    {
      eventos[bucle-1]=eventos[bucle];
    }
    strncpy(timeandevent, reloj.time(), sizeof(timeandevent));
    strncat(timeandevent, quepaso, (sizeof(timeandevent) - strlen(timeandevent)) );
    eventos[15]=timeandevent;
}

but when see screen al work fine in first run, see that



but if event ocurr call routine @ same way see happend.
this screen 4 events ,
i don't know why replace same values last. put same time, seems routine don't move values...

the problem here
code: [select]

    strncpy(timeandevent, reloj.time(), sizeof(timeandevent));
    strncat(timeandevent, quepaso, (sizeof(timeandevent) - strlen(timeandevent)) );

this code find in google put text time of watch
if don't use work , need time event.
can body me ?

i need make

eventos[15]=reloj.time() + quepaso ;  //  both text ...
but not correct code c++

code: [select]
for (int bucle=1; bucle<16; bucle++)
    {
      eventos[bucle-1]=eventos[bucle];
    }


this piece of code move elements of array,  in way intended,   but never last element of array.


Arduino Forum > Using Arduino > Programming Questions > Help please , I need to put the time and a text in a array


arduino

Comments