TINF_TwoLeds_Bsp1

Dependencies:   TwoLeds mbed

Files at this revision

API Documentation at this revision

Comitter:
Wizo
Date:
Thu Nov 15 18:15:09 2018 +0000
Parent:
0:23f5cf9d9707
Commit message:
TINF_TwoLEDs

Changed in this revision

TwoLeds.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show diff for this revision Revisions of this file
diff -r 23f5cf9d9707 -r ecc648c8da1c TwoLeds.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TwoLeds.lib	Thu Nov 15 18:15:09 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/TINF_6ABEL18/code/TwoLeds/#047ba38fb71d
diff -r 23f5cf9d9707 -r ecc648c8da1c main.cpp
--- a/main.cpp	Mon Jun 18 13:16:35 2018 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-#include "mbed.h"
-
-
-class TwoLeds {
-public:
-    TwoLeds(PinName pin1, PinName pin2) : _pin1(pin1), _pin2(pin2) {     // Initialisierungsliste
-    _pin1 = 0;                            // Initialisierung mit 0
-    _pin2 = 0;
-}
-
-void ledOn(void) {
-    _pin1 = 1;
-    _pin2 = 1;
-}
-
-void ledOff(void) {
-    _pin1 = 0;
-    _pin2 = 0;
-}
-
-void ledX() {
-    if( _pin1 == 0 && _pin2 == 0){
-        _pin1 = 1;
-        _pin2 = 0;
-    }
-    else if(_pin1 == 1 && _pin2 == 0){
-        _pin1 = 0;
-        _pin2 = 1;
-    }
-    else if(_pin1 == 0 && _pin2 == 1){
-        _pin1 = 1;
-        _pin2 = 0;
-    }
-
-}
-
-void printStatus(void) {
-    printf("LED1 is now: %d\n", _pin1.read());
-    printf("LED2 is now: %d\n", _pin2.read());
-}
-    
-private:
-    DigitalOut _pin1;
-    DigitalOut _pin2;
-    
-};
-
-
-DigitalOut led(LED1);
-// MyLed myled2(LED2);                 // Instanziierung des Objektes
-// MyLed myled5(p5);
-
-TwoLeds twoleds(LED1, LED2);
-
-int main() {
-    while (1) {
-        /*twoleds.ledOn();             // Zugriff auf die Methode über "."-Operator
-        twoleds.printStatus();
-        wait_ms(500);
-        twoleds.ledOff();            // Zugriff auf die Methode über "."-Operator
-        twoleds.printStatus();
-        wait_ms(500); */
-        twoleds.ledX();
-        twoleds.printStatus();
-        wait_ms(500);
-        
-
-    }
-}
\ No newline at end of file