YIC day 1

Dependencies:   mbed

Revision:
0:a025d9524e28
--- /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();
+    }
+}