Dependencies:   mbed

Revision:
0:5b52db367115
diff -r 000000000000 -r 5b52db367115 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Nov 26 15:52:53 2009 +0000
@@ -0,0 +1,50 @@
+#include "mbed.h"
+
+PwmOut myled(LED1);
+
+bool back = false;
+float drive = 0;
+
+Timer timer;
+
+int main() 
+{
+    int start = 0;
+    int current = 0;
+    
+    timer.start();
+    
+    myled = 1.0;
+    
+    while(1) 
+    {
+        current = timer.read_ms();
+    
+        if((current - start) >= 10)
+        {
+            if(back)
+            {
+                drive -= 0.01;
+                
+                if(drive <= 0)
+                {
+                    drive = 0;
+                    back = false;
+                }
+            }
+            else
+            {
+                drive += 0.01;
+                
+                if(drive >= 1)
+                {
+                    drive = 0.999;
+                    back = true;
+                }
+            }
+    
+            myled = drive;
+            start = timer.read_ms();
+        }
+    }
+}
\ No newline at end of file