Ligne 17 : |
Ligne 17 : |
| #include <ZumoMotors.h> | | #include <ZumoMotors.h> |
| | | |
− | #define THROTTLE_PIN 4 // throttle channel from RC receiver | + | #define THROTTLE_PIN 4 // Canal accélération (throttle) du récepteur RC |
− | #define STEERING_PIN 5 // steering channel from RC receiver | + | #define STEERING_PIN 5 // Canal de direction (steering) du récepteur RC |
− | #define LED_PIN 13 // user LED pin | + | #define LED_PIN 13 // broche de la LED utilisateur |
| | | |
− | #define MAX_SPEED 400 // max motor speed | + | #define MAX_SPEED 400 // Vitesse max moteur |
− | #define PULSE_WIDTH_DEADBAND 25 // pulse width difference from 1500 us (microseconds) to ignore (to compensate for control centering offset) | + | #define PULSE_WIDTH_DEADBAND 25 // Différence de largeur d'impulsion depuis 1500 us (microseconds) à ignorer (pour compenser l'offset/décalage de la position centrale) |
− | #define PULSE_WIDTH_RANGE 350 // pulse width difference from 1500 us to be treated as full scale input (for example, a value of 350 means | + | #define PULSE_WIDTH_RANGE 350 // Différence de largeur d'impulsion depuis 1500 us qui doit être considéré comme l'amplitude totale de l'entrée (valeur max) |
− | // any pulse width <= 1150 us or >= 1850 us is considered full scale) | + | // Par exemple une valeur de 350 signifie l'utilisation d'une largeur d'impulsion (pulse width) <= 1150 us OU >= 1850 us |
| + | // est considérée comme ayant atteint l'amplitude maximale de l'entrée (de la manette de contrôle) |
| | | |
| | | |
Ligne 31 : |
Ligne 32 : |
| pinMode(LED_PIN, OUTPUT); | | pinMode(LED_PIN, OUTPUT); |
| | | |
− | // uncomment one or both of the following lines if your motors' directions need to be flipped | + | // Décommenter une ou deux ligne pour corriger la direction du moteur (si nécessaire) |
| //motors.flipLeftMotor(true); | | //motors.flipLeftMotor(true); |
| //motors.flipRightMotor(true); | | //motors.flipRightMotor(true); |
Ligne 38 : |
Ligne 39 : |
| void loop() | | void loop() |
| { | | { |
| + | // accélération : |
| int throttle = pulseIn(THROTTLE_PIN, HIGH); | | int throttle = pulseIn(THROTTLE_PIN, HIGH); |
| + | // direction |
| int steering = pulseIn(STEERING_PIN, HIGH); | | int steering = pulseIn(STEERING_PIN, HIGH); |
| | | |
Ligne 45 : |
Ligne 48 : |
| if (throttle > 0 && steering > 0) | | if (throttle > 0 && steering > 0) |
| { | | { |
− | // both RC signals are good; turn on LED | + | // Les deux signaux both RC signals are good; turn on LED |
| digitalWrite(LED_PIN, HIGH); | | digitalWrite(LED_PIN, HIGH); |
| | | |