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.
Dependencies: mbed
Revision 0:c0fd2733e2bb, committed 2019-01-08
- Comitter:
- BurtonChang
- Date:
- Tue Jan 08 03:01:38 2019 +0000
- Commit message:
- UART
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Tue Jan 08 03:01:38 2019 +0000
@@ -0,0 +1,55 @@
+#include "mbed.h"
+
+//------------------------------------
+// Hyperterminal configuration
+// 9600 bauds, 8-bit data, no parity
+//------------------------------------
+
+Serial pc(SERIAL_TX, SERIAL_RX);
+char username[8];
+char userkey;
+DigitalOut myled(LED1);
+
+int main(){
+ myled=1;
+
+ pc.printf("Hello World,please enter you name to continue\r\n");
+
+ pc.scanf("%s",username);
+
+ pc.printf("Hello %s,please enter return to continue\r\n",username);
+
+ while (pc.readable())
+
+ pc.getc();
+
+ while (1){
+
+ userkey=pc.getc();
+
+ if (userkey=='a'){
+
+ for (int j=0;j<3;j++){
+
+ myled=1;
+
+ wait(1);
+
+ myled=0;
+
+ wait(1);
+ }
+
+ break;
+
+ }
+
+ else
+
+ pc.printf("Wrong key,please enter return key to continue \r\n");
+
+ }
+
+ pc.printf("Right key,Good Bye \r\n");
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Jan 08 03:01:38 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/3a7713b1edbc \ No newline at end of file