AresENSEA-CDF2020 / Mbed 2 deprecated AresCDFMainCode_us2

Dependencies:   mbed DRV8825

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers motors.cpp Source File

motors.cpp

00001 /* #include */
00002 #include "pins.h"
00003 
00004 /* Initialisation des drivers */
00005 void drv_init()
00006 {
00007     mot_dis();
00008     motGauche_fwd();
00009     motDroite_fwd();
00010 
00011     mode_M0 = 1;
00012     //mode_M1 = 1;
00013     //mode_M2 = 1;
00014 }
00015 
00016 /* Activation des moteurs */
00017 void mot_en() // Activation des moteurs
00018 {
00019     drvGauche.setEnable(START);
00020     drvDroite.setEnable(START);
00021 }
00022 
00023 /* Désactivation des moteurs */
00024 void mot_dis() // Désactivation des moteurs
00025 {
00026     drvGauche.setEnable(STOP);
00027     drvDroite.setEnable(STOP);
00028 }
00029 
00030 /* Rotation moteur vers l'avant */
00031 void motGauche_fwd()
00032 {
00033     drvGauche.setDir(FORWARD);
00034     //drvGauche.setDir(BACKWARD);
00035 }
00036 
00037 void motDroite_fwd()
00038 {
00039     drvDroite.setDir(BACKWARD);
00040     //drvDroite.setDir(FORWARD);
00041 }
00042 
00043 /* Rotation moteur vers l'arrière */
00044 void motGauche_bck()
00045 {
00046     drvGauche.setDir(BACKWARD);
00047     //drvGauche.setDir(FORWARD);
00048 }
00049 
00050 void motDroite_bck()
00051 {
00052     drvDroite.setDir(FORWARD);
00053     //drvDroite.setDir(BACKWARD);
00054 }
00055 
00056 /* Changement de vitesse des moteurs */
00057 void vitesseMotG(double vitesse)
00058 {
00059     drvGauche.moveLinSpeed((double)vitesse);
00060 }
00061 
00062 void vitesseMotD(double vitesse)
00063 {
00064     drvDroite.moveLinSpeed((double)vitesse);
00065 }
00066 
00067 /* Fonction test des moteurs */
00068 void test_drv()
00069 {
00070     /* Rien */
00071 }