Markus Reiner

Files at this revision

API Documentation at this revision

Comitter:
mexx
Date:
Wed Jun 20 17:15:15 2018 +0000
Commit message:
Markus Reiner

Changed in this revision

TwoLeds.cpp Show annotated file Show diff for this revision Revisions of this file
TwoLeds.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TwoLeds.cpp	Wed Jun 20 17:15:15 2018 +0000
@@ -0,0 +1,27 @@
+#include "mbed.h"
+#include "TwoLeds.h"
+ 
+ void TwoLeds:: ledOn(void)
+    {
+    _pin=1;
+    _pin2=1;
+    }
+
+    void TwoLeds:: ledOff(void)
+    {
+        _pin=0;
+        _pin2=0;
+    }
+    void TwoLeds:: ledX(void)
+    {
+      _pin = _pin2;
+      _pin2 = !_pin2;
+    
+    }
+    
+    
+    void TwoLeds:: printStatus(void)
+    {
+     printf("Read LED1 is now %d\n LED2 is now %d\n", _pin.read(), _pin2.read()); 
+     //printf("Read LED is now %d\n", _pin2.read()); 
+    }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TwoLeds.h	Wed Jun 20 17:15:15 2018 +0000
@@ -0,0 +1,25 @@
+#include "mbed.h"
+#ifndef TwoLeds_H
+#define TwoLeds_H
+
+
+class TwoLeds
+{
+    public:
+        TwoLeds(PinName pin, PinName pin2 ) : _pin(pin) , _pin2(pin2) // initialisierungsliste ( muss gleich heissen wie der Konstruktor )
+        {
+            _pin=0;                     // initalisierung mit 0
+            _pin2=0;
+        }
+        
+    void ledOn(void);
+    void ledOff(void);
+    void ledX(void); 
+    void printStatus(void);
+ 
+    private:
+        DigitalOut _pin; // _steht im Namen für privat, am Anfang oder am ende
+        DigitalOut _pin2; 
+};
+
+#endif
\ No newline at end of file