int RUN_button_touched(){ static U8 button_state = 0; int result=0; if(button_state==1 && ecrobot_is_RUN_button_pressed()==0 ){ result = 1; } else { result = 0; } button_state= ecrobot_is_RUN_button_pressed(); return result; }
int UI::courseSelect(){ int course = -1; display_goto_xy(4, 1); while(1){ if(ecrobot_is_RUN_button_pressed()){ course = course * (-1); if(course == 1){ display_string(" IN COURSE"); display_goto_xy(4, 1); } else{ display_string("OUT COURSE"); display_goto_xy(4, 1); } } if(ecrobot_is_ENTER_button_pressed()){ display_goto_xy(6, 3); display_string("READY"); break; } display_update(); // 500msecウェイトする systick_wait_ms(500); } display_update(); return course; }
int tyreal_trigger(){ int result=0; if (ecrobot_is_RUN_button_pressed() == 1) { systick_wait_ms(100); result = 1; } return result; }
void do_tyreal(float *Kp_t,float *Ki_t,float *Kd_t){ //�ó‘Ô‘JˆÚ if (ecrobot_is_RUN_button_pressed() == 1) { ecrobot_sound_tone(932, 512, VOL); systick_wait_ms(100); ecrobot_sound_tone(466, 256, VOL); systick_wait_ms(10); systick_wait_ms(10); if(adjust_param_state==ADJUST_Kp_VAL){ adjust_param_state=ADJUST_Ki_VAL; } else if(adjust_param_state==ADJUST_Ki_VAL){ adjust_param_state=ADJUST_Kd_VAL; } else if(adjust_param_state==ADJUST_Kd_VAL){ adjust_param_state=ADJUST_Kp_VAL; } } switch(adjust_param_state) { case (ADJUST_Kp_VAL): *Kp_t=change_float_param(*Kp_t); break; case (ADJUST_Ki_VAL): *Ki_t=change_float_param(*Ki_t); break; case (ADJUST_Kd_VAL): *Kd_t=change_float_param(*Kd_t); break; default: break; } display_clear(1); float_to_string(*Kp_t,float_string); display_show_string("Kp",0,0); display_show_string(float_string,0,1); float_to_string(*Ki_t,float_string); display_show_string("Ki",0,2); display_show_string(float_string,0,3); float_to_string(*Kd_t,float_string); display_show_string("Kd",0,4); display_show_string(float_string,0,5); }