//The main loop! int main() { //Initialize all devices init_devices(); lcd_set_4bit(); lcd_init(); leftVel=100; rightVel=100; functionFlag=0; while(1) { //Extract out commands from received data process_rcvd_data(); //Perform certain actions according to the state of the Firebird if (white_line_flag) { whiteline_follow_continue(); } if (acc_flag) { acc_continue(); } if (acc_modified_flag) { acc_modified(); } //If there exists a command on the command buffer, call the invoker on it if(command_rcvd >= 1){ unsigned char a; int error = get_char_from_input(&a); if (error == -1) { //lcd_string("ERROR"); buzzer_prompt(1000); _delay_ms(1000); buzzer_prompt(1000); command_rcvd--; continue; } //lcd_num(a); my_invoker(a); command_rcvd--; //serial_sendString("ok"); } } }
//Called when whiteline following needs to be enabled void whiteline_follow_start() { white_line_flag = 1; whiteline_follow_continue(); }