Hey there
I find that when making a program that I now always make a function called "StopProgram".
It usually looks something like this:
void StopProgram(int A_variable) {
Serial.print(A_variable); // to see what a variable is doing at a certain point...
for(;;); //Program will stop here
}
The advantage of using this is that you can debug your program one line at a time.
Also, if you are having trouble with:
if (Cstate >= 10000 && Cstate <= 19999){
zoCommandVelocityMove(NodeID,5000);
delay(3000);
}
else if(Cstate >= 20000 && Cstate <= 29999){
int i = Cstate - 20000;
zoCommandRelativePositionMove(NodeID,i);
delay(3300);
}
else if(Cstate >= 30000 && Cstate <= 39999){
int i = Cstate - 30000;
zoCommandAbsolutePositionMove(NodeID,i);
delay(3300);
}
}
... Maybe you could try:
if (Cstate >= 10000 && Cstate <= 19999){
zoCommandVelocityMove(NodeID,5000);
delay(3000);
}
else {
Long i = Cstate % 10000; //<-----See below
zoCommandRelativePositionMove(NodeID,i);
delay(3300);
}
------> because Cstate is not an integer: It is a "Long".
Hope all goes well
