This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int tempo = millis(); | |
int delay = 1000; //Tempo de delay em ms | |
while(millis()-tempo<delay){ | |
//executar o código | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int Estados(){ | |
if(direito && esquerdo){ | |
estado_ini=0; | |
return 0; | |
} | |
if(direito){ | |
estado_ini=-1; | |
return -1; | |
} | |
if(esquerdo){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void PID_SegueLinha(){ | |
int error = Estado_Atual() - setPoint; | |
I+=error; | |
int motorSpeed = KP * error + KD * (error - lastError) + KI*I; | |
lastError=error; |