Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
motors.cpp
- Committer:
- Nanaud
- Date:
- 2020-07-21
- Revision:
- 5:34ed652f8c31
- Parent:
- 4:ad9b7355332e
- Child:
- 6:ea6b30c4bb01
File content as of revision 5:34ed652f8c31:
// Nom du fichier : motors.cpp
#include "pins.h"
void drv_init()
{
mot_dis();
motGauche_fwd();
motDroite_fwd();
drvGauche.moveLinSpeed(0.1);
drvDroite.moveLinSpeed(0.1);
mode = 0b111; // M0, M1 et M2 sont à 1
}
// ENABLE/DISABLE // Les deux modules ont le même enable
void mot_en()
{
drvGauche.setEnable(START);
//drvDroite.setEnable(START);
}
void mot_dis()
{
drvGauche.setEnable(STOP);
//drvDroite.setEnable(STOP);
}
// FORWARD
void motGauche_fwd()
{
drvGauche.setDir(FORWARD);
}
void motDroite_fwd()
{
drvDroite.setDir(BACKWARD);
}
// BACKWARD
void motGauche_bck()
{
drvGauche.setDir(BACKWARD);
}
void motDroite_bck()
{
drvDroite.setDir(FORWARD);
}
// TESTS
void test_drv()
{
mot_en();
motGauche_fwd();
motDroite_fwd();
drvGauche.moveLinSpeed(0.250); // 0.035
drvDroite.moveLinSpeed(0.250); // 0.035
wait(2);
motGauche_bck();
motDroite_bck();
wait(2);
mot_dis();
}
void testAngle(int cmdAngle){}