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 1:66b36106613a, committed 2021-11-04
- Comitter:
- CSTritt
- Date:
- Thu Nov 04 13:13:30 2021 +0000
- Parent:
- 0:f4431aea05f2
- Commit message:
- Added explicit serial port creation, but not fully updated.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r f4431aea05f2 -r 66b36106613a main.cpp --- a/main.cpp Fri Nov 03 02:19:44 2017 +0000 +++ b/main.cpp Thu Nov 04 13:13:30 2021 +0000 @@ -5,10 +5,11 @@ Demonstrates some uses of pointers. Written by: Dr. C. S. Tritt - Created: 9/24/17 (v. 1.0) + Created: 11/4/21 (v. 1.1) */ #include "mbed.h" +Serial pc(USBTX, USBRX, 9600); // Explicitly create serial connection. int main() { printf("\nPointer Play -- \"a is a.\"\n"); @@ -20,8 +21,8 @@ int* pNum2 = NULL; // Create a NULL (unassigned) pointer. pNum2 = &myNum2; // Put the address in the pointer. *pNum2 = 15; // Dereference the pointer to store a value. - printf("myNum2 is %d and *pNum2 is %d.\n", myNum2, *pNum2); + pc.printf("myNum2 is %d and *pNum2 is %d.\n", myNum2, *pNum2); // Examine the addresses (pointer values). - printf("pNum1 is %p and pNum2 is %p.\n", pNum1, pNum2); + pc.printf("pNum1 is %p and pNum2 is %p.\n", pNum1, pNum2); while(true); // Wait here forever. } \ No newline at end of file