my library for elec350
Diff: Button.cpp
- Revision:
- 3:d62097c19a4e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Button.cpp Wed Oct 19 20:33:20 2016 +0000
@@ -0,0 +1,13 @@
+#include "Button.h"
+
+bool Button::isPressed()
+{
+// get current value of input pin
+int pinValue = this->pin->read();
+// check the value returned from the pin
+if (pinValue == 1){
+ return true;
+ }else{
+ return false;
+ }
+ }
\ No newline at end of file