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.
Dependencies: mbed
Classes/Deplacement.cpp@15:3d4543a6c100, 2019-06-03 (annotated)
- Committer:
- Wael_H
- Date:
- Mon Jun 03 16:37:37 2019 +0000
- Revision:
- 15:3d4543a6c100
- Parent:
- 13:9c62e263f245
- Child:
- 16:05665faaa489
cherche balle v2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Wael_H | 10:efa507ba2b35 | 1 | #include "Deplacement.h" |
Wael_H | 10:efa507ba2b35 | 2 | #include "CAN_asser.h" |
Wael_H | 10:efa507ba2b35 | 3 | |
Wael_H | 10:efa507ba2b35 | 4 | Deplacement::Deplacement() |
Wael_H | 10:efa507ba2b35 | 5 | { |
Wael_H | 10:efa507ba2b35 | 6 | this->peutBouger = true; |
Wael_H | 10:efa507ba2b35 | 7 | } |
Wael_H | 10:efa507ba2b35 | 8 | |
Wael_H | 15:3d4543a6c100 | 9 | bool Deplacement::avance(signed short dist) |
Wael_H | 10:efa507ba2b35 | 10 | { |
Wael_H | 10:efa507ba2b35 | 11 | if(this->peutBouger) |
Wael_H | 10:efa507ba2b35 | 12 | { |
Wael_H | 10:efa507ba2b35 | 13 | GoStraight(dist,0,0,0); |
Wael_H | 10:efa507ba2b35 | 14 | this->peutBouger = false; |
Wael_H | 10:efa507ba2b35 | 15 | } |
Wael_H | 10:efa507ba2b35 | 16 | else |
Wael_H | 10:efa507ba2b35 | 17 | majFlagDpl(this->peutBouger); |
Wael_H | 10:efa507ba2b35 | 18 | |
Wael_H | 10:efa507ba2b35 | 19 | return this->peutBouger; |
Wael_H | 10:efa507ba2b35 | 20 | } |
Wael_H | 10:efa507ba2b35 | 21 | |
Wael_H | 15:3d4543a6c100 | 22 | bool Deplacement::tourne(signed short angle) |
Wael_H | 10:efa507ba2b35 | 23 | { |
Wael_H | 10:efa507ba2b35 | 24 | if(this->peutBouger) |
Wael_H | 10:efa507ba2b35 | 25 | { |
Wael_H | 10:efa507ba2b35 | 26 | Rotate(angle); |
Wael_H | 10:efa507ba2b35 | 27 | this->peutBouger = false; |
Wael_H | 10:efa507ba2b35 | 28 | } |
Wael_H | 10:efa507ba2b35 | 29 | else |
Wael_H | 10:efa507ba2b35 | 30 | majFlagDpl(this->peutBouger); |
Wael_H | 10:efa507ba2b35 | 31 | |
Wael_H | 10:efa507ba2b35 | 32 | return this->peutBouger; |
Wael_H | 10:efa507ba2b35 | 33 | } |
Wael_H | 10:efa507ba2b35 | 34 | |
Wael_H | 15:3d4543a6c100 | 35 | bool Deplacement::GoToXYT(unsigned short x, unsigned short y, unsigned short t, signed char sens) //sens = 0 par défaut |
Wael_H | 10:efa507ba2b35 | 36 | { |
Wael_H | 10:efa507ba2b35 | 37 | if(this->peutBouger) |
Wael_H | 10:efa507ba2b35 | 38 | { |
Wael_H | 10:efa507ba2b35 | 39 | GoToPosition(x,y,t,sens); |
Wael_H | 10:efa507ba2b35 | 40 | this->peutBouger = false; |
Wael_H | 10:efa507ba2b35 | 41 | } |
Wael_H | 10:efa507ba2b35 | 42 | else |
Wael_H | 10:efa507ba2b35 | 43 | majFlagDpl(this->peutBouger); |
Wael_H | 10:efa507ba2b35 | 44 | |
Wael_H | 10:efa507ba2b35 | 45 | return this->peutBouger; |
Wael_H | 13:9c62e263f245 | 46 | } |
Wael_H | 13:9c62e263f245 | 47 | |
Wael_H | 13:9c62e263f245 | 48 | void Deplacement::stop() |
Wael_H | 13:9c62e263f245 | 49 | { |
Wael_H | 13:9c62e263f245 | 50 | SendRawId(ASSERVISSEMENT_STOP); |
Wael_H | 15:3d4543a6c100 | 51 | |
Wael_H | 15:3d4543a6c100 | 52 | do majFlagDpl(this->peutBouger); |
Wael_H | 15:3d4543a6c100 | 53 | while(!this->peutBouger); |
Wael_H | 10:efa507ba2b35 | 54 | } |