/*
Made on Dec 12, 2020
By MehranMaleki @ Electropeak
Home
*/
const int buttonPin_RST = 2; // the number of the reset button pin
const int buttonPin_SET = 3; // the number of the set button pin
const int buttonPin_MID = 4; // the number of the middle button pin
const int buttonPin_RHT = 5; // the number of the right button pin
const int buttonPin_LFT = 6; // the number of the left button pin
const int buttonPin_DWN = 7; // the number of the down button pin
const int buttonPin_UP = 8; // the number of the up button pin
void setup() {
Serial.begin(9600);
pinMode(buttonPin_RST, INPUT_PULLUP);
pinMode(buttonPin_SET, INPUT_PULLUP);
pinMode(buttonPin_MID, INPUT_PULLUP);
pinMode(buttonPin_RHT, INPUT_PULLUP);
pinMode(buttonPin_LFT, INPUT_PULLUP);
pinMode(buttonPin_DWN, INPUT_PULLUP);
pinMode(buttonPin_UP, INPUT_PULLUP);
}
void loop() {
if(digitalRead(buttonPin_RST) == LOW) {
delay(250);
Serial.println("Reset Pin Is Pressed.");
while(digitalRead(buttonPin_RST) == LOW);
}
if(digitalRead(buttonPin_SET) == LOW) {
delay(250);
Serial.println("Set Pin Is Pressed.");
while(digitalRead(buttonPin_SET) == LOW);
}
if(digitalRead(buttonPin_MID) == LOW) {
delay(250);
Serial.println("Middle Pin Is Pressed.");
while(digitalRead(buttonPin_MID) == LOW);
}
if(digitalRead(buttonPin_RHT) == LOW) {
delay(250);
Serial.println("Right Pin Is Pressed.");
while(digitalRead(buttonPin_RHT) == LOW);
}
if(digitalRead(buttonPin_LFT) == LOW) {
delay(250);
Serial.println("Left Pin Is Pressed.");
while(digitalRead(buttonPin_LFT) == LOW);
}
if(digitalRead(buttonPin_DWN) == LOW) {
delay(250);
Serial.println("Down Pin Is Pressed.");
while(digitalRead(buttonPin_DWN) == LOW);
}
if(digitalRead(buttonPin_UP) == LOW) {
delay(250);
Serial.println("Up Pin Is Pressed.");
while(digitalRead(buttonPin_UP) == LOW);
}
}
商品評價
目前沒有評價。