int PB_PIN=5; int Motor_Pin=25; int PB_CONDITION = 0; void setup() { // put your setup code here, to run once: pinMode(PB_PIN,INPUT_PULLUP); pinMode(Motor_Pin,OUTPUT); Serial.begin(115200); } void loop() { // put your main code here, to run repeatedly: PB_CONDITION=digitalRead(PB_PIN); if(PB_CONDITION==LOW) { digitalWrite(Motor_Pin, HIGH); } else digitalWrite(Motor_Pin, LOW); Serial.println(PB_CONDITION); delay(100); }