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
main.cpp
- Committer:
- BurtonChang
- Date:
- 2019-01-08
- Revision:
- 0:c0fd2733e2bb
File content as of revision 0:c0fd2733e2bb:
#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");
}