const int buttonPin =14;
// the number of the pushbutton pin
// variables will change:
int buttonState = 0;
// Biền lưu trang thái nút nhẫn
void setup() {
Serial.begin(115200);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
Serial.println("Setup Done");
delay(1000);
}
void loop() {
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on
Serial.println("Dang nhan nút");
} else {
//turn LED off
Serial.println("Không nhan nút");
}
}