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.
Revision 116:a08f67e4d8e1, committed 2021-10-21
- Comitter:
- CSTritt
- Date:
- Thu Oct 21 10:16:51 2021 +0000
- Parent:
- 115:f22cbbc92bae
- Commit message:
- Added explicit Serial port, pc.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r f22cbbc92bae -r a08f67e4d8e1 main.cpp --- a/main.cpp Wed Oct 13 14:27:35 2021 +0000 +++ b/main.cpp Thu Oct 21 10:16:51 2021 +0000 @@ -12,22 +12,24 @@ */ #include "mbed.h" +Serial pc(USBTX, NC, 9600); + int main() { const int DELAY = 2000000;; // mS wait time. const char ESC = 27; // Define escape character for escape sequence. - printf("%c[2J%c[H", ESC, ESC); // ANSI/VT100 clear screen/home. + pc.printf("%c[2J%c[H", ESC, ESC); // ANSI/VT100 clear screen/home. // Replace the code below with your code. - int count = 1; // Declared in outer block. - int iCount = 0; // This is another variable called count. + int count = 1; // Do while loop counter. + int iCount = 0; // Counter in do-while loop. do { --iCount; // this applies to inner count. printf("Count Down = %d and abs(Count Down) = %d\n", iCount, abs(iCount)); } while( ++count <= 5); // This works with outer count. - printf("count = %d\n", count); // Inner count is dead. + pc.printf("count = %d\n", count); while(true) { // Main forever loop. ThisThread::sleep_for(DELAY); // Pause