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.
main.cpp@0:e67b3d8994f1, 2018-09-26 (annotated)
- Committer:
- pnkpntr
- Date:
- Wed Sep 26 14:50:55 2018 +0000
- Revision:
- 0:e67b3d8994f1
Final_Working
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| pnkpntr | 0:e67b3d8994f1 | 1 | #include "mbed.h" |
| pnkpntr | 0:e67b3d8994f1 | 2 | |
| pnkpntr | 0:e67b3d8994f1 | 3 | Serial pc(USBTX, USBRX); |
| pnkpntr | 0:e67b3d8994f1 | 4 | DigitalOut led (LED1); |
| pnkpntr | 0:e67b3d8994f1 | 5 | |
| pnkpntr | 0:e67b3d8994f1 | 6 | char cmd[100]; |
| pnkpntr | 0:e67b3d8994f1 | 7 | |
| pnkpntr | 0:e67b3d8994f1 | 8 | int main() { |
| pnkpntr | 0:e67b3d8994f1 | 9 | //pc.baud(19200); |
| pnkpntr | 0:e67b3d8994f1 | 10 | pc.baud(921600); |
| pnkpntr | 0:e67b3d8994f1 | 11 | //pc.printf("Echoes back to the screen anything you type\n"); |
| pnkpntr | 0:e67b3d8994f1 | 12 | while(1) { |
| pnkpntr | 0:e67b3d8994f1 | 13 | if (pc.readable()>0) |
| pnkpntr | 0:e67b3d8994f1 | 14 | { |
| pnkpntr | 0:e67b3d8994f1 | 15 | led = 1; |
| pnkpntr | 0:e67b3d8994f1 | 16 | pc.scanf("%s",cmd); |
| pnkpntr | 0:e67b3d8994f1 | 17 | //pc.putc(pc.getc()); |
| pnkpntr | 0:e67b3d8994f1 | 18 | led = 0; |
| pnkpntr | 0:e67b3d8994f1 | 19 | pc.printf(cmd); |
| pnkpntr | 0:e67b3d8994f1 | 20 | } |
| pnkpntr | 0:e67b3d8994f1 | 21 | else |
| pnkpntr | 0:e67b3d8994f1 | 22 | { |
| pnkpntr | 0:e67b3d8994f1 | 23 | //led = !led; |
| pnkpntr | 0:e67b3d8994f1 | 24 | wait(0.2); |
| pnkpntr | 0:e67b3d8994f1 | 25 | } |
| pnkpntr | 0:e67b3d8994f1 | 26 | } |
| pnkpntr | 0:e67b3d8994f1 | 27 | } |