yajuan yue / Mbed 2 deprecated ele350

Dependencies:   mbed

Fork of ele350 by JIAWEI ZHANG

Committer:
GGHHHH
Date:
Thu Oct 15 10:38:34 2015 +0000
Revision:
0:b43794060b94
Child:
6:f804bb3faa26
Created library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
GGHHHH 0:b43794060b94 1 #include "Led.h" //includes the header with the class definition
GGHHHH 0:b43794060b94 2
GGHHHH 0:b43794060b94 3 //constructor
GGHHHH 0:b43794060b94 4 Led::Led(string s) //contructor implementation
GGHHHH 0:b43794060b94 5 {
GGHHHH 0:b43794060b94 6 if(s== "red")
GGHHHH 0:b43794060b94 7 pin= PD_14; //The pin for the red led
GGHHHH 0:b43794060b94 8
GGHHHH 0:b43794060b94 9 l = new DigitalOut(pin);
GGHHHH 0:b43794060b94 10 }
GGHHHH 0:b43794060b94 11
GGHHHH 0:b43794060b94 12 void Led::On() //function implementation
GGHHHH 0:b43794060b94 13 {
GGHHHH 0:b43794060b94 14 l->write(1); //set the value of the pin to l
GGHHHH 0:b43794060b94 15 }
GGHHHH 0:b43794060b94 16
GGHHHH 0:b43794060b94 17 void Led::Off()
GGHHHH 0:b43794060b94 18 {
GGHHHH 0:b43794060b94 19 l->write(0); //set the value of the pin to 0
GGHHHH 0:b43794060b94 20 }