void Process_LED_Control(void*arg){ char c; while(1){ // wait until something is received do{ /* * In a process, "el_process_cooperate" need to be called in any * polling loops. See the documentation of the Process module to * learn more details. */ el_process_cooperate(); }while(el_uart_get_char_counter(EL_UART_1)==0); c = el_uart_get_char(EL_UART_1); if(c=='f'){ el_led_set(EL_LED_FRONT,EL_TOGGLE); } } }
void Process_ConsoleLoop(void*arg){ char c; int i; elu_printf("EL_EXAMPLE_04\n"); // setup the task Task_ObjectFollowing_Setup(); el_process_wait(500);// wait for 500 ms el_uart_flush_char(EL_UART_1); while(1){ do{ el_process_cooperate(); }while(el_uart_get_char_counter(EL_UART_1)==0); c = el_uart_get_char(EL_UART_1); switch(c){ case 'f': el_led_set(EL_LED_FRONT,EL_TOGGLE); break; case 'r':// report ir proximity sensor outputs elu_println("<IR>"); el_ir_proximity_get(EL_IR_PROXIMITY_SENSOR_ALL,EL_IR_ALL_3V,(el_int16*)ProximitySensor); elu_printf("AMB:"); for(i=0;i<8;i++){ elu_printf("\t%d",ProximitySensor[i].Ambient); } elu_putchar('\n'); elu_printf("REF:"); for(i=0;i<8;i++){ elu_printf("\t%d",ProximitySensor[i].Reflection); } elu_putchar('\n'); break; case 'p':// report image processing result elu_println("<IMG>"); elu_println("MASS:\t%d\t%d\t%d",vision_mass_red,vision_mass_green,vision_mass_blue); elu_println("BIAS:\t%d\t%d\t%d",vision_bias_red,vision_bias_green,vision_bias_blue); elu_putchar('\n'); break; case '1': Task_ObjectColor = TASK_OBJECT_RED; elu_println("FOLLOW RED"); break; case '2': Task_ObjectColor = TASK_OBJECT_GREEN; elu_println("FOLLOW GREEN"); break; case '3': Task_ObjectColor = TASK_OBJECT_BLUE; elu_println("FOLLOW BLUE"); break; } } Task_ObjectFollowing_Clear(); }