Markus Reiner / Pwm

Files at this revision

API Documentation at this revision

Comitter:
mexx
Date:
Thu Jun 21 07:03:40 2018 +0000
Commit message:
PWm Reiner

Changed in this revision

Pwm.cpp Show annotated file Show diff for this revision Revisions of this file
Pwm.h Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r f3c23f8ad677 Pwm.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Pwm.cpp	Thu Jun 21 07:03:40 2018 +0000
@@ -0,0 +1,18 @@
+#include "mbed.h"
+#include "Pwm.h"
+       
+       void MyPwm:: dimUp(void)
+       {
+           if (_pin != 1)
+               _pin = _pin + 0.1;
+       }
+       void MyPwm:: dimDown(void)
+       {
+           if (_pin != 0)
+               _pin = _pin - 0.1;
+
+       }
+       void MyPwm:: printStatus(void)
+       {
+           printf("Status der Led: %1.1f \n", (float)_pin);
+       }
\ No newline at end of file
diff -r 000000000000 -r f3c23f8ad677 Pwm.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Pwm.h	Thu Jun 21 07:03:40 2018 +0000
@@ -0,0 +1,22 @@
+#include "mbed.h"
+#ifndef Pwm_H
+#define Pwm_H
+
+class MyPwm
+{
+   private:
+       PwmOut _pin;
+   public:
+       MyPwm(PinName pin): _pin(pin)
+       {
+           _pin = 0;
+       }
+
+       void dimUp(void);
+       void dimDown(void);
+       void printStatus(void);
+     
+};
+
+
+#endif
\ No newline at end of file