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@1:1e85a02fe11a, 2019-02-21 (annotated)
- Committer:
- fabiofaria
- Date:
- Thu Feb 21 00:36:53 2019 +0000
- Revision:
- 1:1e85a02fe11a
- Parent:
- 0:4d8b265728c9
- Child:
- 4:4b9d96e6c509
Robot library added.
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 | 0:4d8b265728c9 | 3 | |
fabiofaria | 1:1e85a02fe11a | 4 | Serial pc(SERIAL_TX, SERIAL_RX); |
fabiofaria | 0:4d8b265728c9 | 5 | |
fabiofaria | 0:4d8b265728c9 | 6 | int main() { |
fabiofaria | 0:4d8b265728c9 | 7 | while(1) { |
fabiofaria | 1:1e85a02fe11a | 8 | getCountsAndReset(); // Call getCountsAndReset() to read the values of encoders |
fabiofaria | 1:1e85a02fe11a | 9 | // and reset them. The values become available on variables |
fabiofaria | 1:1e85a02fe11a | 10 | // "countsLeft" and "countsRight". |
fabiofaria | 1:1e85a02fe11a | 11 | |
fabiofaria | 1:1e85a02fe11a | 12 | // setSpeeds(20, 50); // Uncomment to set a speed of 20 for the |
fabiofaria | 1:1e85a02fe11a | 13 | // left motor and 50 for the right motor. |
fabiofaria | 1:1e85a02fe11a | 14 | |
fabiofaria | 1:1e85a02fe11a | 15 | pc.printf("Encoders: Left=%d Right=%d\n", countsLeft, countsRight); |
fabiofaria | 1:1e85a02fe11a | 16 | |
fabiofaria | 1:1e85a02fe11a | 17 | wait(0.5); // Delay of 0.5 seconds. |
fabiofaria | 0:4d8b265728c9 | 18 | } |
fabiofaria | 1:1e85a02fe11a | 19 | } |