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
main.cpp@19:dad67302af25, 2019-06-05 (annotated)
- Committer:
- Wael_H
- Date:
- Wed Jun 05 13:25:52 2019 +0000
- Revision:
- 19:dad67302af25
- Parent:
- 17:aae5361ddddf
- Child:
- 20:a1b5d032b422
derniere version Classe Robot
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Wael_H | 2:8971078b1ccf | 1 | #include "mbed.h" |
| Wael_H | 5:34048faec367 | 2 | #include "CAN_asser.h" |
| Wael_H | 10:efa507ba2b35 | 3 | #include "Robot.h" |
| Wael_H | 10:efa507ba2b35 | 4 | |
| Wael_H | 16:05665faaa489 | 5 | void automate_testDeplacement(Robot&); |
| Wael_H | 8:94ecfe411d02 | 6 | |
| Wael_H | 2:8971078b1ccf | 7 | int main(void) |
| Wael_H | 2:8971078b1ccf | 8 | { |
| Wael_H | 10:efa507ba2b35 | 9 | Robot robot; |
| theolp | 17:aae5361ddddf | 10 | |
| theolp | 17:aae5361ddddf | 11 | robot.setSpeed(40,400); |
| theolp | 17:aae5361ddddf | 12 | |
| theolp | 17:aae5361ddddf | 13 | Timer timer_dbug; |
| theolp | 17:aae5361ddddf | 14 | timer_dbug.start(); |
| Wael_H | 15:3d4543a6c100 | 15 | |
| Wael_H | 15:3d4543a6c100 | 16 | while(1) |
| theolp | 17:aae5361ddddf | 17 | { |
| Wael_H | 16:05665faaa489 | 18 | automate_testDeplacement(robot); |
| theolp | 17:aae5361ddddf | 19 | |
| theolp | 17:aae5361ddddf | 20 | if(timer_dbug.read() > 0.5f) |
| theolp | 17:aae5361ddddf | 21 | { |
| theolp | 17:aae5361ddddf | 22 | dbug.printf("PosX : %d --- PosY : %d\n\r", robot.pos(Robot::X), robot.pos(Robot::Y)); |
| theolp | 17:aae5361ddddf | 23 | dbug.printf("Angle : %d degres\n\r", robot.pos(Robot::THETA) / 10 ); |
| theolp | 17:aae5361ddddf | 24 | sauter_lignes(25); |
| theolp | 17:aae5361ddddf | 25 | timer_dbug.stop(); |
| theolp | 17:aae5361ddddf | 26 | timer_dbug.reset(); |
| theolp | 17:aae5361ddddf | 27 | timer_dbug.start(); |
| theolp | 17:aae5361ddddf | 28 | } |
| theolp | 17:aae5361ddddf | 29 | } |
| Wael_H | 15:3d4543a6c100 | 30 | } |
| Wael_H | 15:3d4543a6c100 | 31 | |
| Wael_H | 16:05665faaa489 | 32 | void automate_testDeplacement(Robot& robot) |
| Wael_H | 15:3d4543a6c100 | 33 | { |
| theolp | 17:aae5361ddddf | 34 | typedef enum{AVANCE,TOURNE} type_etat; |
| Wael_H | 16:05665faaa489 | 35 | static type_etat etat = AVANCE; |
| Wael_H | 7:753e901d441b | 36 | |
| Wael_H | 7:753e901d441b | 37 | switch(etat) |
| Wael_H | 9:2113adf37c66 | 38 | { |
| Wael_H | 16:05665faaa489 | 39 | case AVANCE: |
| theolp | 17:aae5361ddddf | 40 | if(robot.avance(500)) |
| Wael_H | 16:05665faaa489 | 41 | etat = TOURNE; |
| Wael_H | 13:9c62e263f245 | 42 | break; |
| Wael_H | 13:9c62e263f245 | 43 | |
| Wael_H | 16:05665faaa489 | 44 | case TOURNE: |
| theolp | 17:aae5361ddddf | 45 | if(robot.tourne(900)) |
| theolp | 17:aae5361ddddf | 46 | etat = AVANCE; |
| Wael_H | 13:9c62e263f245 | 47 | break; |
| Wael_H | 13:9c62e263f245 | 48 | } |
| Wael_H | 13:9c62e263f245 | 49 | } |
| Wael_H | 16:05665faaa489 | 50 |