YIC day 1

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
lingtien5846
Date:
Thu Apr 02 05:12:00 2015 +0000
Commit message:
YIC day 1

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
diff -r 000000000000 -r a025d9524e28 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Apr 02 05:12:00 2015 +0000
@@ -0,0 +1,36 @@
+#include "mbed.h"
+
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+
+void sqr() {
+    float x = 1.0;
+    unsigned int n = 1000000;
+    while (x*x < n) {
+        x = x + 0.5;
+        //printf("x = %f\n", x);
+    }
+    led2 = 1;
+    led1 = 0;
+}
+
+int main() {
+    led1 = 1;
+    //led2 = 0;
+    
+        wait(0.2);
+        led1 = 0;
+        wait(0.2);
+        led1 = 1; 
+        wait(0.2);
+        led1 = 0;
+        wait(0.2);
+        led1 = 1; 
+        wait(0.2);
+        led1 = 0;    
+    while(1) {
+
+                                  
+        sqr();
+    }
+}
diff -r 000000000000 -r a025d9524e28 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Apr 02 05:12:00 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e188a91d3eaa
\ No newline at end of file