JIAWEI ZHANG / Mbed 2 deprecated ele350ku

Dependencies:   mbed

Dependents:   Exercise8_1-2-3

Fork of ele350 by JIAWEI ZHANG

Revision:
14:5d3bd2e4ac91
Parent:
7:f3c3cb6cea26
Child:
15:8c0d195355d2
--- a/Led.cpp	Thu Nov 12 13:38:11 2015 +0000
+++ b/Led.cpp	Thu Nov 19 12:47:08 2015 +0000
@@ -1,28 +1,27 @@
-#include "Led.h"        //includes the header with the class definition 
-
+#include "led.h"        //includes the header with the class definition 
+#include <vector>
 //constructor
-Led::Led(string s)      //contructor implementation
+Led::Led(string name)      //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);
-
+    if(name == "red"){
+    this->pinName = PD_14;         //The pin for the red led
+} else if(name == "green"){
+    this->pinName = PD_12;
+} else if(name == "orange"){
+    this->pinName = PD_13;    
+} else if(name == "blue"){
+    this->pinName = PD_15;    
 }
 
-void Led::On()          //function implementation
-{
-     l->write(1);       //set the value of the pin to l
+void Led::On() {         
+     this->pin->write(1);
+     this->isOn = true;
 }
 
-void Led::Off()
-{
-     l->write(0);       //set the value of the pin to 0
-}
\ No newline at end of file
+void Led::Off(){
+     this->pin->write(0);
+     this->isOn = false;
+}
+    bool Led::getIsOn(){
+        return this->isOn;
+}