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
Diff: buttom.cpp
- 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