AresENSEA-CDF2020
/
AresCDFMainCode_capteur_US
Capteur_US
motors.cpp@0:dc036b67c87c, 2020-07-08 (annotated)
- Committer:
- Nanaud
- Date:
- Wed Jul 08 19:51:28 2020 +0000
- Revision:
- 0:dc036b67c87c
- Child:
- 1:2fe8c402ee79
Code principal du projet
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Nanaud | 0:dc036b67c87c | 1 | #include "pins.h" |
Nanaud | 0:dc036b67c87c | 2 | |
Nanaud | 0:dc036b67c87c | 3 | void drv_init(){ |
Nanaud | 0:dc036b67c87c | 4 | mot_dis(); |
Nanaud | 0:dc036b67c87c | 5 | } |
Nanaud | 0:dc036b67c87c | 6 | |
Nanaud | 0:dc036b67c87c | 7 | void test_drv(){ |
Nanaud | 0:dc036b67c87c | 8 | mot_en(); |
Nanaud | 0:dc036b67c87c | 9 | motGauche_fwd(); |
Nanaud | 0:dc036b67c87c | 10 | drvGauche.move(1); |
Nanaud | 0:dc036b67c87c | 11 | wait(2); |
Nanaud | 0:dc036b67c87c | 12 | motGauche_bck(); |
Nanaud | 0:dc036b67c87c | 13 | wait(2); |
Nanaud | 0:dc036b67c87c | 14 | mot_dis(); |
Nanaud | 0:dc036b67c87c | 15 | } |
Nanaud | 0:dc036b67c87c | 16 | |
Nanaud | 0:dc036b67c87c | 17 | // ENABLE/DISABLE // Les deux modules ont le même enable |
Nanaud | 0:dc036b67c87c | 18 | void mot_en(){ |
Nanaud | 0:dc036b67c87c | 19 | drvGauche.setEnable(START); |
Nanaud | 0:dc036b67c87c | 20 | //drvDroite.setEnable(START); |
Nanaud | 0:dc036b67c87c | 21 | } |
Nanaud | 0:dc036b67c87c | 22 | |
Nanaud | 0:dc036b67c87c | 23 | void mot_dis(){ |
Nanaud | 0:dc036b67c87c | 24 | drvGauche.setEnable(STOP); |
Nanaud | 0:dc036b67c87c | 25 | //drvDroite.setEnable(STOP); |
Nanaud | 0:dc036b67c87c | 26 | } |
Nanaud | 0:dc036b67c87c | 27 | |
Nanaud | 0:dc036b67c87c | 28 | // FORWARD |
Nanaud | 0:dc036b67c87c | 29 | void motGauche_fwd(){ |
Nanaud | 0:dc036b67c87c | 30 | drvGauche.setDir(FORWARD); |
Nanaud | 0:dc036b67c87c | 31 | } |
Nanaud | 0:dc036b67c87c | 32 | |
Nanaud | 0:dc036b67c87c | 33 | void motDroite_fwd(){ |
Nanaud | 0:dc036b67c87c | 34 | drvDroite.setDir(FORWARD); |
Nanaud | 0:dc036b67c87c | 35 | } |
Nanaud | 0:dc036b67c87c | 36 | |
Nanaud | 0:dc036b67c87c | 37 | // BACKWARD |
Nanaud | 0:dc036b67c87c | 38 | void motGauche_bck(){ |
Nanaud | 0:dc036b67c87c | 39 | drvGauche.setDir(BACKWARD); |
Nanaud | 0:dc036b67c87c | 40 | } |
Nanaud | 0:dc036b67c87c | 41 | |
Nanaud | 0:dc036b67c87c | 42 | void motDroite_bck(){ |
Nanaud | 0:dc036b67c87c | 43 | drvDroite.setDir(BACKWARD); |
Nanaud | 0:dc036b67c87c | 44 | } |