Pages: 1 [2]   Go Down
Author Topic: Pin 13 blinks, and void loop doesnt loop  (Read 1246 times)
0 Members and 1 Guest are viewing this topic.
Melbourne, Australia
Offline Offline
Full Member
***
Karma: 0
Posts: 219
Have you tried turning it off and on again?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey there

I find that when making a program that I now always make a function called "StopProgram".

It usually looks something like this:

Code:
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:

Code:
   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:

Code:
   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 smiley
Logged

Pages: 1 [2]   Go Up
Jump to: