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.
button.cpp@1:16b0f2898739, 2015-10-15 (annotated)
- Committer:
- Oschofield
- Date:
- Thu Oct 15 11:20:49 2015 +0000
- Revision:
- 1:16b0f2898739
- Child:
- 2:e3cd1e0c3b78
Added button classes and methods;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Oschofield | 1:16b0f2898739 | 1 | #include "button.h" //header file included |
Oschofield | 1:16b0f2898739 | 2 | |
Oschofield | 1:16b0f2898739 | 3 | |
Oschofield | 1:16b0f2898739 | 4 | Button::Button(string s){ |
Oschofield | 1:16b0f2898739 | 5 | if (s == "user"){ |
Oschofield | 1:16b0f2898739 | 6 | pin = new DigitalIn(PA_0); |
Oschofield | 1:16b0f2898739 | 7 | } |
Oschofield | 1:16b0f2898739 | 8 | } |
Oschofield | 1:16b0f2898739 | 9 | |
Oschofield | 1:16b0f2898739 | 10 | bool Button::ifPressed();{ |
Oschofield | 1:16b0f2898739 | 11 | int ButtonPress = read(); |
Oschofield | 1:16b0f2898739 | 12 | |
Oschofield | 1:16b0f2898739 | 13 | if (ButtonPress==1){ |
Oschofield | 1:16b0f2898739 | 14 | return true; |
Oschofield | 1:16b0f2898739 | 15 | |
Oschofield | 1:16b0f2898739 | 16 | else{ |
Oschofield | 1:16b0f2898739 | 17 | return false; |
Oschofield | 1:16b0f2898739 | 18 | } |
Oschofield | 1:16b0f2898739 | 19 | } |
Oschofield | 1:16b0f2898739 | 20 | } |