Bulme_Übungen

Simulator TwoLeds

Aufgabe 1: TwoLed

Blinken und Schalten

added components : 2 LEDs (p5,p6)

http://ec2-52-211-146-247.eu-west-1.compute.amazonaws.com:7829/#user_1528963870845

CLASS TwoLed

class TwoLed{
    public:
    TwoLed(PinName pin1, PinName pin2): _led1(pin1), _led2(pin2){  //konstruktor  + initialisierungsliste
        _led1=0;    
        _led2=0;   
    }
    void ledOn(){
         _led1 =1;
         _led2 =1;
    }
    void ledOff(){
        _led1=0;
        _led2=0; 
    }
    void ledx(){
        _led1=_led2;
        _led2=!_led2;
    }
    void printStatus(void){
        printf("LED is now %d - %d \n", _led1.read(),_led2.read());}

    private:
    DigitalOut _led1;
    DigitalOut _led2;
};