yajuan yue / Mbed 2 deprecated ele350

Dependencies:   mbed

Fork of ele350 by JIAWEI ZHANG

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?

UserRevisionLine numberNew 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 }