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-08
- Revision:
- 1:2fe8c402ee79
- Parent:
- 0:dc036b67c87c
- Child:
- 3:3ba377aafdfd
File content as of revision 1:2fe8c402ee79:
// Nom du fichier : motors.cpp
#include "pins.h"
void drv_init(){
mot_dis();
}
void test_drv(){
mot_en();
motGauche_fwd();
drvGauche.move(1);
wait(2);
motGauche_bck();
wait(2);
mot_dis();
}
// 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(FORWARD);
}
// BACKWARD
void motGauche_bck(){
drvGauche.setDir(BACKWARD);
}
void motDroite_bck(){
drvDroite.setDir(BACKWARD);
}