Réglage du sens des moteurs et des codeurs
This commit is contained in:
parent
bda33196ec
commit
23bc31cfac
12
Moteurs.c
12
Moteurs.c
@ -91,22 +91,22 @@ void Moteur_SetVitesse(enum t_moteur moteur, int16_t vitesse ){
|
||||
case MOTEUR_A:
|
||||
pwm_set_chan_level(5, PWM_CHAN_B, u_vitesse);
|
||||
if(vitesse > 0){
|
||||
gpio_put(M1_SENS1, 0);
|
||||
gpio_put(M1_SENS2, 1);
|
||||
}else{
|
||||
gpio_put(M1_SENS1, 1);
|
||||
gpio_put(M1_SENS2, 0);
|
||||
}else{
|
||||
gpio_put(M1_SENS1, 0);
|
||||
gpio_put(M1_SENS2, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case MOTEUR_B:
|
||||
pwm_set_chan_level(4, PWM_CHAN_B, u_vitesse);
|
||||
if(vitesse < 0){
|
||||
gpio_put(M2_SENS1, 0);
|
||||
gpio_put(M2_SENS2, 1);
|
||||
}else{
|
||||
gpio_put(M2_SENS1, 1);
|
||||
gpio_put(M2_SENS2, 0);
|
||||
}else{
|
||||
gpio_put(M2_SENS1, 0);
|
||||
gpio_put(M2_SENS2, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
6
QEI.c
6
QEI.c
@ -42,9 +42,9 @@ void QEI_init(int identifiant){
|
||||
}
|
||||
// Initialisation des "machines à états" :
|
||||
// QEI1 : broche 11 et 12 - pio : pio0, sm : 0, Offset : 0, GPIO 11 et 12, clock div : 0 pour commencer
|
||||
quadrature_encoder_program_init(pio_QEI, 0, offset, 11, 0);
|
||||
quadrature_encoder_program_init(pio_QEI, 0, offset, 14, 0);
|
||||
// QEI2 : broche 2 et 3 - pio : pio0, sm : 1, Offset : 0, GPIO 2 et 3, clock div : 0 pour commencer
|
||||
quadrature_encoder_program_init(pio_QEI, 1, offset, 2, 0);
|
||||
quadrature_encoder_program_init(pio_QEI, 1, offset, 16, 0);
|
||||
|
||||
QEI_A.value=0;
|
||||
QEI_B.value=0;
|
||||
@ -85,7 +85,7 @@ int QEI_get(enum QEI_name_t qei){
|
||||
break;
|
||||
|
||||
case QEI_B_NAME:
|
||||
return -QEI_B.delta;
|
||||
return QEI_B.delta;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user