
// set pin numbers:
const int WAKE_Pin = 10; // the number of the pushbutton pin
// variables will change:
int buttonState = 1; // variable for reading the pushbutton status
void setup() {
pinMode(WAKE_Pin, INPUT);
Serial.begin(9600);
}
void loop(){
// read the state of the pushbutton value:
buttonState = digitalRead(WAKE_Pin);
// check if the pushbutton is pressed.
// if it is, the buttonState is LOW:
if (buttonState == LOW) {
Serial.println("Button is pressed");
}
else {
Serial.println("Button isn't pressed");
}
delay(100);
}
Statistics : Posted by csbeng • on Sun Jan 04, 2015 1:32 pm • Replies 2 • Views 390