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.
Diff: main.cpp
- Revision:
- 0:edf6285988e2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sun Mar 24 08:48:03 2019 +0000
@@ -0,0 +1,35 @@
+#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;
+ }
+}
\ No newline at end of file