TINF_MyPwm

Dependents:   TINF_MyPwm

Revision:
0:728d17af5d23
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MyPwm.cpp	Fri Jun 22 11:04:29 2018 +0000
@@ -0,0 +1,25 @@
+#include "mbed.h"
+#include "MyPwm.h"
+
+void MyPwm::dimUp(void)
+{
+    while(_pin != 1)
+    {
+        _pin = _pin + 0.1;
+        printStatus();
+        wait_ms(500);
+    }
+}
+void MyPwm::dimDown(void)
+{
+    while (_pin != 0)
+    {
+        _pin = _pin - 0.1;
+        printStatus();
+        wait_ms(500);
+    }
+}
+void MyPwm::printStatus(void)
+{
+    printf("Led-Wert: %1.1f \n", (float)_pin);
+}