yajuan yue / Mbed 2 deprecated ele350

Dependencies:   mbed

Fork of ele350 by JIAWEI ZHANG

Revision:
2:9a0770c4fdd6
Parent:
1:2a1a443f619e
--- a/buttom.cpp	Thu Oct 15 11:09:16 2015 +0000
+++ b/buttom.cpp	Thu Oct 22 10:29:35 2015 +0000
@@ -1,14 +1,20 @@
-#ifndef _BUTTON_H_
-#define _BUTTON_H_
-
-#include "mbed.h"
-#include <string>
+#include "button.h"
 
-class Button {
-   private:
-        // CLASS ATTRIBUTES GO HERE
-   public:
-        // CLASS METHODS GO HERE
-};
-
-#endif
\ No newline at end of file
+Button::Button(string name)
+{
+       if( name == "user");
+       {
+      this->pin = new DigitalIn(PA_0);
+}
+}
+bool Button::isPressed()
+{
+      int pinValue = this->pin->read();
+      if (pinValue == 1)
+      {
+      return true;
+      }
+      else{
+          return false;
+         }
+}
\ No newline at end of file