Task 1.3.1 Solution
Fork of Task131Solution by
main.cpp@2:66122d84f242, 2019-09-10 (annotated)
- Committer:
- noutram
- Date:
- Tue Sep 10 14:29:24 2019 +0000
- Revision:
- 2:66122d84f242
- Parent:
- 0:fed1ab4b2b50
2019
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| noutram | 0:fed1ab4b2b50 | 1 | #include "mbed.h" |
| noutram | 0:fed1ab4b2b50 | 2 | |
| noutram | 0:fed1ab4b2b50 | 3 | //Create an instance of a Serial object called pc |
| noutram | 0:fed1ab4b2b50 | 4 | //Transmit and receive pins have names USBTX and USBRX |
| noutram | 0:fed1ab4b2b50 | 5 | Serial pc(USBTX, USBRX); |
| noutram | 0:fed1ab4b2b50 | 6 | |
| noutram | 0:fed1ab4b2b50 | 7 | int main() { |
| noutram | 0:fed1ab4b2b50 | 8 | |
| noutram | 0:fed1ab4b2b50 | 9 | //Set the baud rate property (bits persecond) |
| noutram | 0:fed1ab4b2b50 | 10 | pc.baud(9600); |
| noutram | 0:fed1ab4b2b50 | 11 | |
| noutram | 0:fed1ab4b2b50 | 12 | //Run in an infinite loop |
| noutram | 0:fed1ab4b2b50 | 13 | while(1) { |
| noutram | 0:fed1ab4b2b50 | 14 | |
| noutram | 0:fed1ab4b2b50 | 15 | //Call the printf method on pc |
| noutram | 0:fed1ab4b2b50 | 16 | pc.printf("Hello World\n"); |
| noutram | 0:fed1ab4b2b50 | 17 | |
| noutram | 0:fed1ab4b2b50 | 18 | //Wait for 1s |
| noutram | 0:fed1ab4b2b50 | 19 | wait(1.0); |
| noutram | 0:fed1ab4b2b50 | 20 | } |
| noutram | 0:fed1ab4b2b50 | 21 | } |
