JIAWEI ZHANG / Mbed 2 deprecated ele350ku

Dependencies:   mbed

Dependents:   Exercise8_1-2-3

Fork of ele350 by JIAWEI ZHANG

Led.cpp

Committer:
GGHHHH
Date:
2015-11-05
Revision:
7:f3c3cb6cea26
Parent:
6:f804bb3faa26
Child:
14:5d3bd2e4ac91

File content as of revision 7:f3c3cb6cea26:

#include "Led.h"        //includes the header with the class definition 

//constructor
Led::Led(string s)      //contructor implementation
{
    if(s== "red")
    pin= PD_14;         //The pin for the red led
    if(s=="green")
    pin= PD_12;
    if(s== "blue")
    pin= PD_15;
    if(s=="orange")
    pin= PD_13;
    
    
    l = new DigitalOut(pin);

}

void Led::On()          //function implementation
{
     l->write(1);       //set the value of the pin to l
}

void Led::Off()
{
     l->write(0);       //set the value of the pin to 0
}