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
- Committer:
- TrongKhoi
- Date:
- 2019-03-24
- Revision:
- 0:edf6285988e2
File content as of revision 0:edf6285988e2:
#include "mbed.h"
Serial pc(USBTX, USBRX); // tx, rx
DigitalOut led1(LED1);
DigitalOut led2(LED2);
DigitalOut led3(LED3);
DigitalOut led4(LED4);
int main() {
int X = 0;
char key;
int i=0;
pc.printf("\nNhap mot so bat ky roi nhan enter de xac nhan:");
while(1){
key = pc.getc();
if(key == '\r'){break;}
X = X*10 + atoi(&key);
//pc.printf("\n%d", X);
i++;
}
pc.printf("\nBan da nhap %d", X);
if(X%4 == 0){
led1=led2=led3=led4=1;
}
if(X%4==1){
led1=1;
}
if(X%4==2){
led1=led2=1;
}
if(X%4==3){
led1=led2=led3=1;
}
}