LAB08_Oppgave1

Dependencies:   mbed

Fork of LAB08_Oppgave1 by EL-POM1001

Files at this revision

API Documentation at this revision

Comitter:
rlanghbv
Date:
Wed Oct 21 09:50:57 2015 +0000
Commit message:
first commit

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 cf9946c35521 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Oct 21 09:50:57 2015 +0000
@@ -0,0 +1,27 @@
+#include "mbed.h"
+
+PwmOut pwmLed(PB_9);
+
+int main()
+{
+    pwmLed.period(0.020); // 20ms Periode tid
+        
+    //Set the led ouput duty-cycle to 1%
+    float brightness=0.01;
+    pwmLed=brightness;
+    
+    printf("Press 'u' to turn LED1 brightness up, 'd' for down\n\r");
+    while(1) {
+
+        char c = getchar();
+        if((c == 'u') && (brightness < 0.1f))
+            brightness += 0.001f;
+        if((c == 'd') && (brightness > 0.0f))
+            brightness -= 0.001f;
+
+        //Set the ouput duty-cycle, specified as a percentage
+        pwmLed = brightness;
+        printf("%c %1.3f \n \r",c,brightness);
+    }
+}
+
diff -r 000000000000 -r cf9946c35521 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Oct 21 09:50:57 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/34e6b704fe68
\ No newline at end of file