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 mbed-rtos Motor LSM9DS1_Library_cal X_NUCLEO_53L0A1
main.cpp@6:c119cc5d48d6, 2019-04-15 (annotated)
- Committer:
- abh15
- Date:
- Mon Apr 15 18:32:16 2019 +0000
- Revision:
- 6:c119cc5d48d6
- Parent:
- 5:77c6821ae418
- Child:
- 8:bfa4bf23522c
Added "globals" file for hardware/variables. Added send and receive code for serial communication
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rpatelpj | 0:66b7ea9af0dc | 1 | #include "mbed.h" |
abh15 | 6:c119cc5d48d6 | 2 | #include "globals.h" |
rpatelpj | 3:1dce1ba5b8bd | 3 | #include "DataDistributor.h" |
rpatelpj | 3:1dce1ba5b8bd | 4 | #include "RobotController.h" |
rpatelpj | 0:66b7ea9af0dc | 5 | |
abh15 | 6:c119cc5d48d6 | 6 | Serial pc(USBTX, USBRX); |
abh15 | 6:c119cc5d48d6 | 7 | DigitalIn pb(p26); |
rpatelpj | 0:66b7ea9af0dc | 8 | |
rpatelpj | 0:66b7ea9af0dc | 9 | int main() { |
abh15 | 6:c119cc5d48d6 | 10 | pb.mode(PullUp); |
rpatelpj | 5:77c6821ae418 | 11 | DataDistributor dataDistributor; |
rpatelpj | 5:77c6821ae418 | 12 | RobotController robotController(p21, p15, p16, p22, p18, p19, p17, p20); |
rpatelpj | 3:1dce1ba5b8bd | 13 | |
rpatelpj | 3:1dce1ba5b8bd | 14 | while(1) { |
rpatelpj | 3:1dce1ba5b8bd | 15 | float* obstacles = robotController.obstacleDetection(); |
rpatelpj | 3:1dce1ba5b8bd | 16 | dataDistributor.sendObstacles(obstacles); |
rpatelpj | 3:1dce1ba5b8bd | 17 | float* trajectory = dataDistributor.receiveTrajectory(); |
rpatelpj | 3:1dce1ba5b8bd | 18 | robotController.followTrajectory(trajectory); |
rpatelpj | 3:1dce1ba5b8bd | 19 | robotController.toOrigin(trajectory); |
rpatelpj | 3:1dce1ba5b8bd | 20 | } |
rpatelpj | 0:66b7ea9af0dc | 21 | } |