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
buttom.cpp@2:9a0770c4fdd6, 2015-10-22 (annotated)
- Committer:
- GGHHHH
- Date:
- Thu Oct 22 10:29:35 2015 +0000
- Revision:
- 2:9a0770c4fdd6
- Parent:
- 1:2a1a443f619e
Created my libiary.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
GGHHHH | 2:9a0770c4fdd6 | 1 | #include "button.h" |
GGHHHH | 1:2a1a443f619e | 2 | |
GGHHHH | 2:9a0770c4fdd6 | 3 | Button::Button(string name) |
GGHHHH | 2:9a0770c4fdd6 | 4 | { |
GGHHHH | 2:9a0770c4fdd6 | 5 | if( name == "user"); |
GGHHHH | 2:9a0770c4fdd6 | 6 | { |
GGHHHH | 2:9a0770c4fdd6 | 7 | this->pin = new DigitalIn(PA_0); |
GGHHHH | 2:9a0770c4fdd6 | 8 | } |
GGHHHH | 2:9a0770c4fdd6 | 9 | } |
GGHHHH | 2:9a0770c4fdd6 | 10 | bool Button::isPressed() |
GGHHHH | 2:9a0770c4fdd6 | 11 | { |
GGHHHH | 2:9a0770c4fdd6 | 12 | int pinValue = this->pin->read(); |
GGHHHH | 2:9a0770c4fdd6 | 13 | if (pinValue == 1) |
GGHHHH | 2:9a0770c4fdd6 | 14 | { |
GGHHHH | 2:9a0770c4fdd6 | 15 | return true; |
GGHHHH | 2:9a0770c4fdd6 | 16 | } |
GGHHHH | 2:9a0770c4fdd6 | 17 | else{ |
GGHHHH | 2:9a0770c4fdd6 | 18 | return false; |
GGHHHH | 2:9a0770c4fdd6 | 19 | } |
GGHHHH | 2:9a0770c4fdd6 | 20 | } |