yajuan yue / Mbed 2 deprecated ele350

Dependencies:   mbed

Fork of ele350 by JIAWEI ZHANG

Files at this revision

API Documentation at this revision

Comitter:
GGHHHH
Date:
Thu Oct 22 10:29:35 2015 +0000
Parent:
1:2a1a443f619e
Child:
3:1ad50b4e51a6
Commit message:
Created my libiary.

Changed in this revision

buttom.cpp Show annotated file Show diff for this revision Revisions of this file
button.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
mbed_blinky.lib Show diff for this revision Revisions of this file
--- 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/button.h	Thu Oct 22 10:29:35 2015 +0000
@@ -0,0 +1,16 @@
+#ifndef _BUTTON_H_
+#define _BUTTON_H_
+
+#include "mbed.h"
+#include <string>
+
+class Button {
+    private:
+              
+    DigitalIn* pin;
+    public:
+    Button(string name);
+    bool isPressed();
+};
+
+#endif
--- a/main.cpp	Thu Oct 15 11:09:16 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-#include "Led.h"        //includes the header with the class definition 
-
-//constructor
-Led::Led(string s)      //contructor implementation
-{
-    if(s== "yellow")
-         pin= PD_14;    //The pin for the yellow led
-         
-    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
-}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Oct 22 10:29:35 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/34e6b704fe68
\ No newline at end of file
--- a/mbed_blinky.lib	Thu Oct 15 11:09:16 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/teams/DBALab-Beacon/code/mbed_blinky/#b27d296776e4