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.
lab2_a.cpp@3:17447b9b1c18, 2020-08-23 (annotated)
- Committer:
- DavidRoss
- Date:
- Sun Aug 23 17:13:14 2020 +0000
- Revision:
- 3:17447b9b1c18
- Parent:
- 2:caa3c6d6d37e
- Child:
- 4:2b6eb949a923
updated Lab2a
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| DavidRoss | 0:94a2d885c9bb | 1 | /* |
| DavidRoss | 0:94a2d885c9bb | 2 | Title: Program to generate output to the PC screen |
| DavidRoss | 0:94a2d885c9bb | 3 | Author: Your Name, Student ID, Course CODE, Lab Section |
| DavidRoss | 0:94a2d885c9bb | 4 | Date: Today's Date |
| DavidRoss | 0:94a2d885c9bb | 5 | Description: This program will take characters from the keyboard and |
| DavidRoss | 0:94a2d885c9bb | 6 | continually send them to the screen. You can use ANSI |
| DavidRoss | 0:94a2d885c9bb | 7 | ESCAPE sequences to position the cursor, clear the |
| DavidRoss | 0:94a2d885c9bb | 8 | screen, and change screen foreground and background |
| DavidRoss | 0:94a2d885c9bb | 9 | colours. |
| DavidRoss | 0:94a2d885c9bb | 10 | */ |
| DavidRoss | 3:17447b9b1c18 | 11 | #include "mbed.h" |
| DavidRoss | 1:6e1ddcab9b76 | 12 | |
| DavidRoss | 0:94a2d885c9bb | 13 | int main(void) |
| DavidRoss | 0:94a2d885c9bb | 14 | { |
| DavidRoss | 0:94a2d885c9bb | 15 | unsigned char input; // variable to get char from keyboard |
| DavidRoss | 0:94a2d885c9bb | 16 | |
| DavidRoss | 0:94a2d885c9bb | 17 | for(;;) { |
| DavidRoss | 0:94a2d885c9bb | 18 | input=getc(stdin); // get char and put into variable input |
| DavidRoss | 0:94a2d885c9bb | 19 | // if(input == 0x0d) // if input is <RETURN> |
| DavidRoss | 0:94a2d885c9bb | 20 | // putc(0x0a,stdout); // output a <LINE FEED> |
| DavidRoss | 0:94a2d885c9bb | 21 | } |
| DavidRoss | 0:94a2d885c9bb | 22 | } |