![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
uses CRLF for playing nice with gnu screen
main.cpp@0:275987079d2a, 2014-11-04 (annotated)
- Committer:
- musashiaharon
- Date:
- Tue Nov 04 10:37:44 2014 +0000
- Revision:
- 0:275987079d2a
fork with LF -> CRLF for compatibility with gnu screen
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
musashiaharon | 0:275987079d2a | 1 | #include "mbed.h" |
musashiaharon | 0:275987079d2a | 2 | #define LF "\n" |
musashiaharon | 0:275987079d2a | 3 | #define CRLF "\r\n" |
musashiaharon | 0:275987079d2a | 4 | #define NL CRLF |
musashiaharon | 0:275987079d2a | 5 | |
musashiaharon | 0:275987079d2a | 6 | DigitalOut myled(LED_GREEN); |
musashiaharon | 0:275987079d2a | 7 | Serial pc(USBTX, USBRX); |
musashiaharon | 0:275987079d2a | 8 | |
musashiaharon | 0:275987079d2a | 9 | |
musashiaharon | 0:275987079d2a | 10 | int main() |
musashiaharon | 0:275987079d2a | 11 | { |
musashiaharon | 0:275987079d2a | 12 | int i = 0; |
musashiaharon | 0:275987079d2a | 13 | pc.printf("Hello World!" NL); |
musashiaharon | 0:275987079d2a | 14 | |
musashiaharon | 0:275987079d2a | 15 | while (true) { |
musashiaharon | 0:275987079d2a | 16 | wait(0.5f); // wait a small period of time |
musashiaharon | 0:275987079d2a | 17 | pc.printf("%d" NL, i); // print the value of variable i |
musashiaharon | 0:275987079d2a | 18 | i++; // increment the variable |
musashiaharon | 0:275987079d2a | 19 | myled = !myled; // toggle a led |
musashiaharon | 0:275987079d2a | 20 | } |
musashiaharon | 0:275987079d2a | 21 | } |