Go Down

Topic: 2 codes in 1 software (Read 485 times) previous topic - next topic

AWOL

Have a look at the blink without delay example, without delay.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

florin

I have made a circuit for the code below:
Code: [Select]

void loop(){

time=millis();

while(millis()-time<10000)
{
    first code
}

time=millis(); 

while(millis()-time<10000)
{
   
}

}


The circuit run the first code for ten seconds, than the second code for 10 second, than first code for ten 10 seconde and than STOP. Why?

billroy

Can't say without seeing all your code (post it all, please), but at a guess you may have declared time as an int instead of an unsigned long.  At least that is what usually causes weird behavior during the first 30 seconds after startup.

-br
http://bitlash.net

Go Up