diff --git a/Robotito/src/main.c b/Robotito/src/main.c index 4e2c27a1b6e0f8cba5307be25b904ee7a173cc5f..3c7c29fc95a8c46ee3b392d205e452659c868e9d 100644 --- a/Robotito/src/main.c +++ b/Robotito/src/main.c @@ -33,28 +33,34 @@ void app_main(void) { //1. mcpwm gpio initialization - motor_h_t *mot; + motor_h_t *mot0; + motor_h_t *mot2; - motor_install(26,27, MCPWM_UNIT_0, MCPWM0A, MCPWM0B, MCPWM_TIMER_0, &mot); + motor_install(26,27, MCPWM_UNIT_0, MCPWM0A, MCPWM0B, MCPWM_TIMER_0, &mot0); + motor_install(18,23, MCPWM_UNIT_1, MCPWM1A, MCPWM1B, MCPWM_TIMER_1, &mot2); // pines de los motores // Motor 0: 26,27 Encoder 0: 37, 39 // Motor 1: 25,33 Encoder 1: 36, 38 // Motor 2: 18,23 Encoder 2: 34, 35 //2. initial mcpwm configuration printf("Configuring Initial Parameters of mcpwm...\n"); - motor_start(mot); //Configure PWM0A & PWM0B with above settings - + motor_start(mot0); //Configure PWM0A & PWM0B with above settings + motor_start(mot2); int inc = 10; while (1) { - motor_set_speed(mot, inc); + motor_set_speed(mot0, inc); + motor_set_speed(mot2, inc); vTaskDelay(2000 / portTICK_RATE_MS); - motor_stop(mot); + motor_stop(mot0); + motor_stop(mot2); vTaskDelay(2000 / portTICK_RATE_MS); - motor_set_speed(mot, -inc); + motor_set_speed(mot0, inc); + motor_set_speed(mot2, -inc); vTaskDelay(2000 / portTICK_RATE_MS); - motor_stop(mot); + motor_stop(mot0); + motor_stop(mot2); vTaskDelay(2000 / portTICK_RATE_MS); inc++;