Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of ele350 by
Revision 2:9a0770c4fdd6, committed 2015-10-22
- 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
--- 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