satbir panesar
/
elec350
my library for elec350
Button.cpp@3:d62097c19a4e, 2016-10-19 (annotated)
- Committer:
- spanesar
- Date:
- Wed Oct 19 20:33:20 2016 +0000
- Revision:
- 3:d62097c19a4e
added microphone files;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
spanesar | 3:d62097c19a4e | 1 | #include "Button.h" |
spanesar | 3:d62097c19a4e | 2 | |
spanesar | 3:d62097c19a4e | 3 | bool Button::isPressed() |
spanesar | 3:d62097c19a4e | 4 | { |
spanesar | 3:d62097c19a4e | 5 | // get current value of input pin |
spanesar | 3:d62097c19a4e | 6 | int pinValue = this->pin->read(); |
spanesar | 3:d62097c19a4e | 7 | // check the value returned from the pin |
spanesar | 3:d62097c19a4e | 8 | if (pinValue == 1){ |
spanesar | 3:d62097c19a4e | 9 | return true; |
spanesar | 3:d62097c19a4e | 10 | }else{ |
spanesar | 3:d62097c19a4e | 11 | return false; |
spanesar | 3:d62097c19a4e | 12 | } |
spanesar | 3:d62097c19a4e | 13 | } |