Library A: LED library to controll the led on the Happy Gecko.

Dependencies:   mbed mbed

led.cpp

Committer:
diana_s
Date:
2018-02-12
Revision:
1:55b5e6d28fb3
Parent:
0:3cabc617d433

File content as of revision 1:55b5e6d28fb3:

#include "LED.h"
#include "mbed.h"

 LED::LED(PinName pin): LEDpin(pin) {
    LEDpin=0;
}
    
void LED::ledOn(){
    LEDpin = 1;
}

void LED::ledOff(){
    LEDpin = 0;
}

void LED::toggle(){
    LEDpin = !LEDpin;
}


void LED::blink(float duration) {
    this->toggle();
    wait(duration);
    this->toggle();
}