|
Re: Using While Statements
If you use a while loop, the program essentially "pauses" there and stops communicating with everything. You should use a global state variable. So, you would have something like:
int gyro_state = 0;
void check_gyro()
{
if (gyro_state == 0 && temp_gyro_angle >= 900)
gyro_state = 1;
if (gyro_state == 0) //temp_gyro_angle has always been less than 900
//insert code here
if (gyro_state == 1) //temp_gyro_angle has been more than 900
//insert code here
}
|