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.
Fork of HelloWorld by
main.cpp@2:8f518d957e27, 2016-03-03 (annotated)
- Committer:
- Yinglei
- Date:
- Thu Mar 03 14:18:44 2016 +0000
- Revision:
- 2:8f518d957e27
- Parent:
- 0:fb6bbc10ffa0
Set up connection between the dev board and putty on PC. ; Control Break or pull down nR is equivalent to reset button, which will run the bin file in the MCU.; Figure out how to communicate between Putty and dev board and how to control all the leds;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
simon | 0:fb6bbc10ffa0 | 1 | #include "mbed.h" |
Yinglei | 2:8f518d957e27 | 2 | #include "flashLED.h" |
simon | 0:fb6bbc10ffa0 | 3 | |
Yinglei | 2:8f518d957e27 | 4 | Serial pc(USBTX, USBRX); // tx, rx |
Yinglei | 2:8f518d957e27 | 5 | |
Yinglei | 2:8f518d957e27 | 6 | LocalFileSystem local("local"); |
simon | 0:fb6bbc10ffa0 | 7 | |
simon | 0:fb6bbc10ffa0 | 8 | int main() { |
Yinglei | 2:8f518d957e27 | 9 | char buffer[128]; |
Yinglei | 2:8f518d957e27 | 10 | FILE *fp = fopen("/local/sample.txt", "r"); |
Yinglei | 2:8f518d957e27 | 11 | if(fp==NULL){ |
Yinglei | 2:8f518d957e27 | 12 | pc.printf("Error opening file.\n"); |
simon | 0:fb6bbc10ffa0 | 13 | } |
Yinglei | 2:8f518d957e27 | 14 | |
Yinglei | 2:8f518d957e27 | 15 | while(fgets(buffer,sizeof(buffer), fp)!=NULL){ |
Yinglei | 2:8f518d957e27 | 16 | FlashAll(); |
Yinglei | 2:8f518d957e27 | 17 | for(int i=0;i<7;i++){ |
Yinglei | 2:8f518d957e27 | 18 | pc.printf("%c", buffer[i]); |
Yinglei | 2:8f518d957e27 | 19 | } |
Yinglei | 2:8f518d957e27 | 20 | } |
Yinglei | 2:8f518d957e27 | 21 | |
Yinglei | 2:8f518d957e27 | 22 | pc.printf("\n"); |
Yinglei | 2:8f518d957e27 | 23 | pc.printf("All commands sent.\n"); |
Yinglei | 2:8f518d957e27 | 24 | pc.printf("\n"); |
Yinglei | 2:8f518d957e27 | 25 | fclose(fp); |
simon | 0:fb6bbc10ffa0 | 26 | } |