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.
main.cpp@4:4b9d96e6c509, 2019-03-04 (annotated)
- Committer:
- fabiofaria
- Date:
- Mon Mar 04 16:05:02 2019 +0000
- Revision:
- 4:4b9d96e6c509
- Parent:
- 1:1e85a02fe11a
- Child:
- 5:7fa3a2a2f603
Initial code. Includes send matrix code.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fabiofaria | 0:4d8b265728c9 | 1 | #include "mbed.h" |
fabiofaria | 1:1e85a02fe11a | 2 | #include "Robot.h" |
fabiofaria | 4:4b9d96e6c509 | 3 | #include "Communication.h" |
fabiofaria | 0:4d8b265728c9 | 4 | |
fabiofaria | 1:1e85a02fe11a | 5 | Serial pc(SERIAL_TX, SERIAL_RX); |
fabiofaria | 0:4d8b265728c9 | 6 | |
fabiofaria | 0:4d8b265728c9 | 7 | int main() { |
fabiofaria | 4:4b9d96e6c509 | 8 | pc.baud(115200); |
fabiofaria | 4:4b9d96e6c509 | 9 | init_radio(&pc); |
fabiofaria | 4:4b9d96e6c509 | 10 | |
fabiofaria | 0:4d8b265728c9 | 11 | while(1) { |
fabiofaria | 4:4b9d96e6c509 | 12 | //getCountsAndReset(); // Call getCountsAndReset() to read the values of encoders |
fabiofaria | 1:1e85a02fe11a | 13 | // and reset them. The values become available on variables |
fabiofaria | 1:1e85a02fe11a | 14 | // "countsLeft" and "countsRight". |
fabiofaria | 1:1e85a02fe11a | 15 | |
fabiofaria | 1:1e85a02fe11a | 16 | // setSpeeds(20, 50); // Uncomment to set a speed of 20 for the |
fabiofaria | 1:1e85a02fe11a | 17 | // left motor and 50 for the right motor. |
fabiofaria | 1:1e85a02fe11a | 18 | |
fabiofaria | 1:1e85a02fe11a | 19 | pc.printf("Encoders: Left=%d Right=%d\n", countsLeft, countsRight); |
fabiofaria | 4:4b9d96e6c509 | 20 | send_odometry(1333, 2889, 3.286, 4.23, 54.29); |
fabiofaria | 1:1e85a02fe11a | 21 | wait(0.5); // Delay of 0.5 seconds. |
fabiofaria | 0:4d8b265728c9 | 22 | } |
fabiofaria | 1:1e85a02fe11a | 23 | } |