yajuan yue / Mbed 2 deprecated ele350

Dependencies:   mbed

Fork of ele350 by JIAWEI ZHANG

Committer:
GGHHHH
Date:
Thu Nov 05 13:11:29 2015 +0000
Revision:
6:f804bb3faa26
Parent:
0:b43794060b94
1

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 6:f804bb3faa26 7 pin= PD_14; //The pin for the red led
GGHHHH 6:f804bb3faa26 8 if(s=="green")
GGHHHH 6:f804bb3faa26 9 pin= PD_12;
GGHHHH 6:f804bb3faa26 10 if(s== "blue")
GGHHHH 6:f804bb3faa26 11 pin= PD_15;
GGHHHH 6:f804bb3faa26 12 if(s=="orange")
GGHHHH 6:f804bb3faa26 13 pin= PD_13;
GGHHHH 6:f804bb3faa26 14
GGHHHH 6:f804bb3faa26 15
GGHHHH 0:b43794060b94 16 l = new DigitalOut(pin);
GGHHHH 6:f804bb3faa26 17
GGHHHH 0:b43794060b94 18 }
GGHHHH 0:b43794060b94 19
GGHHHH 0:b43794060b94 20 void Led::On() //function implementation
GGHHHH 0:b43794060b94 21 {
GGHHHH 0:b43794060b94 22 l->write(1); //set the value of the pin to l
GGHHHH 0:b43794060b94 23 }
GGHHHH 0:b43794060b94 24
GGHHHH 0:b43794060b94 25 void Led::Off()
GGHHHH 0:b43794060b94 26 {
GGHHHH 0:b43794060b94 27 l->write(0); //set the value of the pin to 0
GGHHHH 0:b43794060b94 28 }