Charles Tritt
/
21_SerialPass_v5
New example. Initial version.
blueText.cpp@117:e072f162cbce, 2021-10-17 (annotated)
- Committer:
- CSTritt
- Date:
- Sun Oct 17 13:54:15 2021 +0000
- Revision:
- 117:e072f162cbce
- Parent:
- 116:8990686eedf5
Cleaned up comments.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
CSTritt | 116:8990686eedf5 | 1 | /* File: blueText.cpp |
CSTritt | 116:8990686eedf5 | 2 | |
CSTritt | 116:8990686eedf5 | 3 | This function uses ANSI/VT100 escapse sequences to change text to blue. Serial |
CSTritt | 116:8990686eedf5 | 4 | object must be passed by reference (since it is physically unique and can't be |
CSTritt | 116:8990686eedf5 | 5 | copied). The call will look normal as does the usage of pc here. |
CSTritt | 116:8990686eedf5 | 6 | |
CSTritt | 116:8990686eedf5 | 7 | Created by Dr. C. S. Tritt |
CSTritt | 116:8990686eedf5 | 8 | Last revised: 10/16/21 (v. 1.0) |
CSTritt | 116:8990686eedf5 | 9 | */ |
CSTritt | 116:8990686eedf5 | 10 | |
CSTritt | 116:8990686eedf5 | 11 | // Need for mbed use. |
CSTritt | 116:8990686eedf5 | 12 | #include "mbed.h" |
CSTritt | 116:8990686eedf5 | 13 | |
CSTritt | 116:8990686eedf5 | 14 | // Including the myFuncs.h header here will catch mismatches between the |
CSTritt | 116:8990686eedf5 | 15 | // declaration and the definition. |
CSTritt | 116:8990686eedf5 | 16 | #include "myFuncs.h" |
CSTritt | 116:8990686eedf5 | 17 | |
CSTritt | 116:8990686eedf5 | 18 | void blueText(Serial & pc){ |
CSTritt | 116:8990686eedf5 | 19 | const char ESC = 27; // Define escape character for escape sequence. |
CSTritt | 116:8990686eedf5 | 20 | pc.printf("%c[34m", ESC); // ANSI/VT100 blue text. |
CSTritt | 116:8990686eedf5 | 21 | } |