void AGV_V_set(float speed) { AGV_status.V_Set = speed; run_speed_voltage_control = speed / PI / (D_MOTOR / 100.0) / NOMBER_OF_TURNS_PRE_VOLTAGE_PRE_SECODE; motor_speed_set(RIGHT_MOTOR,speed); motor_speed_set(LEFT_MOTOR,speed); }
void task_main(void *pvParameters) { while(pb_read(pb2) == 0) { // wait for button pressed. } vTaskDelay(1000); for (int speed = 1000; speed < 10000; speed = speed + 50) { motor_go_forward(); motor_speed_set(speed, motor_ch_all); motor_start(motor_ch_all); timer_delay_mil(1000); motor_stop(motor_ch_all); timer_delay_mil(500); motor_go_backward(); motor_speed_set(speed, motor_ch_all); motor_start(motor_ch_all); timer_delay_mil(1000); motor_stop(motor_ch_all); timer_delay_mil(500); motor_turn_right(); motor_speed_set(speed, motor_ch_all); motor_start(motor_ch_all); timer_delay_mil(1000); motor_stop(motor_ch_all); timer_delay_mil(500); motor_turn_left(); motor_speed_set(speed, motor_ch_all); motor_start(motor_ch_all); timer_delay_mil(1000); motor_stop(motor_ch_all); timer_delay_mil(500); } // pidMotorMoveFor1Cell(85); while(1) { } }