tuxduino:
What is Agentduino ? Is it a code generator you're writing ?
I've been discovered
but the name now is Agentino, or better AgentIno...
I hope to show you really soon, it's quite smart, easy (and exciting!)
tuxduino:
Also, is this one the PT library you're using ?
Svensk forskning för hållbar tillväxt| RISE
Yes, exactly that one!
tuxduino:
Ok, tried you code. It restarts almost every time pin 3 goes high. The code is quite complex, and has no comments
so it's difficult to make a detailed analysis... IMHO it has too many new()s, in other words it looks like it's written with a normal PC in mind, not a 2K uP. My suggestion is to carefully review every allocation and pointer passed around. Also, memory consumption should be monitored.
An example:
/* Simple Select Event Function, implementing FIFO Event queue */
bool selectNextEvent(Vector *queue, Event *next) {
if ( queue->size() > 0 ) {
Event nE;
queue->getFirstAndRemove(&nE);
*next=nE;
return true;
}
return false;
}
(Please correct me if I'm wrong...)
You allocate the local variable nE.
You pass it by address to getFirstAndRemove.
You copy nE contents to *next.
Wouldn't it be the same to just pass "next" to getFirstAndRemove(), thus avoiding a (pretty useless, it seems) local variable ?
My 2 cents...
HTH
Ok... i have to admin... i have done so many try that i lost control 
It was my thought i had in last days that, and maybe i found the problem...
The problem is finally this...
I have "Plan" that is an abstract class, that i would like to use as an interface Java-like
to reference other plans (PlanPiano1, PlanPiano2, ... PlanPianoN) that extend Plan and ovverride act().
Later i would like to have one single vector of Plan, instantiated each one with object of the various plans.
But it's seems impossible... i make another try, with the following code (as i remember, didn't have it right now...)
Plan * vec[3]; //Or Plan **vec;
vec[0]= new PlanPiano1();
vec[1]= new PlanPiano2();
vec[2]= new PlanPiano2();
vec[0]->act();
vec[1]->act();
vec[2]->act();
And it does restart again... It seems like C++ can use abstract class to reference child class in a vector... or similar, i'm not expert on that language.
What do you think?
The fact that you try my program is very nice... very helpful community, thank you so much!
P.S. in any case i changed my structure of the program, now it works, but in a not elegant way as it could be with abstract class 