Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
annodomini2
Date:
Thu Nov 26 15:52:53 2009 +0000
Commit message:

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 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
diff -r 000000000000 -r 5b52db367115 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Nov 26 15:52:53 2009 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/32af5db564d4